4 examples of 'print numbers from 1 to 100 in javascript' in JavaScript

Every line of 'print numbers from 1 to 100 in javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
1function formatNumber(n: number) {
2 return n > 9 ? n.toString() : '0' + n
3}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

48function to100(value) {
49 value = value / 255;
50 if (value > 0.04045) {
51 value = (value + 0.055) / 1.055;
52 value = Math.pow(value, 2.4);
53 } else {
54 value = value / 12.92;
55 }
56 return value * 100;
57}
1function formatNumber(n) {
2 const str = n.toString()
3 return str[1] ? str : `0${str}`
4}
1function formatNumber (n) {
2 const str = n.toString()
3 return str[1] ? str : `0${str}`
4}

Related snippets