Example 2: Check Armstrong Number of n Digits // program to check an Armstrong number of n digits // take an input const number = prompt("Enter a positive integer"); const numberOfDigits = number.length; let sum = 0; // create a temporary variable let temp = number; while (temp >...
// program to check if the number is even or odd// take input from the userconstnumber = prompt("Enter a number: ");//check if the number is evenif(number %2==0) {console.log("The number is even."); }// if the number is oddelse{console.log("The number is odd."); } Ru...
Write a JavaScript program to find and print the first 5 happy numbers.Visual Presentation:Sample Solution:JavaScript Code:// Function to check if a number is a happy number function happy_number(num) { var m, n; var c = []; // Continue loop until the number becomes 1 or enters a ...
paularmstrong/normalizr - Normalizes nested JSON according to a schema fabricjs/fabric.js - Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser jlmakes/scrollreveal - Animate elements as they scroll into view. react-bootstrap/react-bootstrap - Bootstrap components built with React...
Check number is Armstrong or not Check whether a Number is Prime or Not Find largest of three numbers Check number is palindrome or not Form validation Design calculator Disable right click on webpage Make the font bold Return multiple elements from function Get URL parameters? Copy text to cli...
Subclassing allows you to override properties from the parent, but it doesn’t allow you to select which properties you want to inherit. These problems are summed up nicely by Joe Armstrong in Coders at Work by Peter Siebel: The problem with object-oriented languages is they’ve got all ...
Check number is Armstrong or not Check whether a Number is Prime or Not Find largest of three numbers Check number is palindrome or not Form validation Design calculator Disable right click on webpage Make the font bold Return multiple elements from function Get URL parameters? Copy text to cli...
paularmstrong/swig - Take a swig of the best template engine for JavaScript. davidjbradshaw/iframe-resizer - Keep same and cross domain iFrames sized to their content with support for window/content resizing, in page links, nesting and multiple iFrames. hoodiehq/hoodie - 🐶 The Offline Firs...
Example: Check Prime Number // program to check if a number is prime or not // take input from the user const number = parseInt(prompt("Enter a positive number: ")); let isPrime = true; // check if number is equal to 1 if (number === 1) { console.log("1 is neither prime ...
// program to convert decimal to binary // take input const number = parseInt(prompt('Enter a decimal number: ')); // convert to binary const result = number.toString(2); console.log('Binary:' + ' ' + result); Run Code Output Enter a decimal number: 9 Binary: 1001 In the abov...