javascript

javascript

Leap year program in JavaScript with example

JavaScript program to check if a year is a leap year or not. We will learn how to check for leap year by using a separate function and with HTML and JavaScript.

Read
javascript

How to print Floyd's triangle in JavaScript in 3 ways

JavaScript program to print Floyd's triangle. We will learn three different ways to print the triangle, by using for loops, while loops and with a separate function.

Read
javascript

3 ways in JavaScript to print the Fibonacci series

JavaScript program to print the Fibonacci series in three different ways. This program will show you how to use for loop, while loop and recursive function to print the Fibonacci series.

Read
javascript

JavaScript program to convert a seconds value to HH:mm:ss

JavaScript program to convert a seconds value to hour, minute and seconds or HH:mm:ss format. We will also learn how to convert it to other formats.

Read
javascript

JavaScript program to calculate BMI with user input values

JavaScript program to calculate BMI with user input values. It will take the weight and height as inputs from the user, calculate the BMI and print the output.

Read
javascript

How to sort the array elements in descending order in JavaScript

Different ways to sort the array elements in descending order in JavaScript. Learn how to reverse sort an array of numbers, array of characters and array of objects.

Read
javascript

3 ways in JavaScript to remove duplicate items from an array

3 different ways in JavaScript to remove duplicate items from an array. Learn how to remove duplicate items by iterating over the array, by using filter and by converting the array to a set.

Read
javascript

4 different JavaScript program to find the factorial of a number

4 different ways in JavaScript to find the factorial of a number. Learn how to find the factorial by using a for loop, while loop, recursively and with an arrow function.

Read
javascript

JavaScript program to print the ASCII values from A to Z alphabet

Different ways in JavaScript to print the ASCII values from A to Z or a to z. We will use a for loop, while loop and forEach loops with charCodeAt method to print the ASCII values of the alphabets.

Read
javascript

How to get all Keys of a JavaScript Object

How to get all keys of an object in JavaScript in different ways. We can use Object.keys(), or we can iterate through the keys of an object by using a loop.

Read