Tag Archives: JavaScript Examples

JS Example for Beginners: JavaScript Program to Count the Number of Vowels in a String

(JavaScript programming Example for Beginners) JavaScript Program to Count the Number of Vowels in a String In this example, you will learn to write a JavaScript program that counts the number of vowels in a string. The five letters a, e, i, o and u are called vowels. All other alphabets except these 5 vowels are called consonants. Example 1: Count …

JS Example for Beginners: JavaScript Program to Convert the First Letter of a String in to Upper Case

(JavaScript programming Example for Beginners) JavaScript Program to Convert the First Letter of a String in to Upper Case In this example, you will learn to write a JavaScript program that converts the first letter of a string into uppercase. Example 1: Convert First letter to Upper Case // program to convert first letter of …

JS Example for Beginners: JavaScript Program to Reverse a String

(JavaScript programming Example for Beginners) JavaScript Program to Reverse a String In this tutorial, you will learn to write a JavaScript program that reverses a string. Example 1: Reverse a String using for loop // program to reverse a string function reverseString(str) { // empty string let newString = “”; for (let i = str.length …

JS Example for Beginners: JavaScript Program to Convert Decimal to Binary

(JavaScript programming Example for Beginners) JavaScript Program to Convert Decimal to Binary In this example, you will learn to write a JavaScript program that converts a decimal number to a binary number.   Example 1: Convert Decimal to Binary // program to convert decimal to binary function convertToBinary(x) { let bin = 0; let rem, …