JavaScript Tutorials and Examples

Java tutorials for Beginners – Java EnumMap

Hits: 30 (Java programming Example for Beginners) Java EnumMap In this tutorial, we will learn about the Java EnumMap class and its operations with the help of examples. The EnumMap class of the Java collections framework provides a map implementation for elements of an enum. In EnumMap, enum elements are used as keys. It implements the Map interface. Before we …

JS Example for Beginners: JavaScript Program to Compare The Value of Two Dates

Hits: 6 (JavaScript programming Example for Beginners) JavaScript Program to Compare The Value of Two Dates In this example, you will learn to write a JavaScript program that will compare the values of two dates.   Example: Compare Value of Two Dates // program to compare value of two dates // create two dates let …

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

Hits: 10 (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 …

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

Hits: 3 (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 …

JS Example for Beginners: JavaScript Program to Reverse a String

Hits: 2 (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 …

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

Hits: 11 (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; …

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

Hits: 4 (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 …

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

Hits: 4 (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 ( …

JS Example for Beginners: JavaScript Program to Display the Multiplication Table

Hits: 5 (JavaScript programming Example for Beginners) JavaScript Program to Display the Multiplication Table In this example, you will learn to generate the multiplication table of a number in JavaScript. Example 1: Multiplication Table Up to 10 // program to generate a multiplication table // take input from the user let number = parseInt(prompt(‘Enter an …

JS Example for Beginners: JavaScript Program to Print all Prime Numbers in an Interval

Hits: 6 (JavaScript programming Example for Beginners) JavaScript Program to Print all Prime Numbers in an Interval In this example, you will learn to write a JavaScript program to print all the prime numbers between two numbers entered by a user. A prime number is a positive integer that is only divisible by 1 and itself. For …

JS Example for Beginners: JavaScript Program to Check Prime Number

Hits: 4 (JavaScript programming Example for Beginners) JavaScript Program to Check Prime Number In this example, you will learn to write a JavaScript program to check if a number is a prime number or not. A prime number is a positive integer that is only divisible by 1 and itself. For example, 2, 3, 5, 7, 11 are the first few prime numbers. …