Answers for "number function in javascript"

2

number pyramid in javascript

// Display pyramid of number using JavaScript
var totalNumberOfRows = 5;
var output = "";
for (var i = 1; i <= totalNumberOfRows; i++) {
   for (var j = 1; j <= i; j++) {
      output += j + " ";
   }
   console.log(output);
   output = "";
}
Posted by: Guest on January-05-2021
0

javascript number length

export function numberLength(number) {
	let length = 0;
	let n = Math.abs(number);
	do {
		n /= 10;
		length++;
	} while (n >= 1);
	return length;
}

export default numberLength;
Posted by: Guest on April-25-2020

Code answers related to "number function in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language