Tag Archives: JavaScript Tutorials

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, …

JS Example for Beginners: JavaScript Program to Find the Factors of a Number

(JavaScript programming Example for Beginners) JavaScript Program to Find the Factors of a Number In this example, you will learn to write a JavaScript program that finds all the factors of an integer. To be the factors of a number, the factor number should exactly divide the number (with 0 remainder). For example, The factor of 12 is 1, 2, 3, 4, 6, and 12. …

JS Example for Beginners: JavaScript Program to Make a Simple Calculator

(JavaScript programming Example for Beginners) JavaScript Program to Make a Simple Calculator In this example, you will learn to write a program to make a simple calculator in JavaScript. Example 1: Simple Calculator with if..else if…else // program for a simple calculator // take the operator input let operator = prompt(‘Enter operator ( either +, …