////////////////////////////////loop/////////////////////////////////////////////////////
// for(i=0; i<=50; i++){
// console.log(i);
// }
////// even on odd////////////
console.log("Enter a number");
// let num =prompt("Enter a number")
num = 33;
console.log(num%2==0?"Even Number":"Odd Number")
//
//get username and add @ in it with length of name
// let name = prompt("Enter your unique UserName");
name="vikas"
let length = name.length;
let userName = "@"+name+length;
console.log("Your userName is :", userName);
//reverse a string
let str = "i am vikas nagar"
let strlen = str.length;
let reverseStr=" ";
for(i=0;i<=strlen;i++){
reverseStr += str.charAt(strlen-i)
}
console.log(reverseStr)
// count number of vowels in a word
let word = "vikasisdon";
let count = 0;
for (let i = 0; i < word.length; i++) {
let char = word.charAt(i);
count = (char == "a" || char == "e" || char == "i" || char == "o" || char == "u") ? ++count : count;
}
console.log("Total vowels =", count);
//capital the first letter
let x = "hello vikas"
console.log(x.replace(x.charAt(0),x.charAt(0).toUpperCase()))
///control structure
// FizzBuzz
// Print numbers 1 to 50. But for multiples of 3, print "Fizz" instead of the number, for multiples of 5 print "Buzz", and for multiples of both 3 and 5 print "FizzBuzz".
for(i=0;i<=50;i++){
console.log(i%3==0&&i%5==0?"FizzBuzz":i%3==0?"Fizz":i%5==0?"Buzz":i);
}
To embed this program on your website, copy the following code and paste it into your website's HTML: