+ 3
What is analog a prompt.
We have to get a number isn't a string. user enter something in browser,function cheak this. If it's a number, function add num in array. I need analog prompt becouse he return string. If +"a" will number it's not suitable.
5 Antworten
+ 6
let numb = +prompt("Enter a number, please");
console.log(numb); // "number"
Nope?
+ 4
Here is the lesson about prompt:
https://www.sololearn.com/learn/JavaScript/1149/?ref=app
Also, you can convert the string received to a number like this:
let number = parseInt(prompt('Enter a number'));
+ 2
Please describe your question in more detail so that somebody can help you.
0
user enter something in browser,function cheak this.
If it's a number, function add num in array
0
var arr = [];
var n = parseFloat(prompt("Please, enter a number");
if(n!=NaN)
arr.push(n);
else
alert("This is not a number");