+ 3
function sum(n){for(var i = 1;i>= 5;i++ ){ let n=0; n+=i;}} console.log(sum()) //where is the mistake .why does it not work? //t
Tell where the mistake is please
55 Answers
+ 15
i<=5 ๐ป
+ 7
There is no "return" in your function
+ 2
Ouch.. sorry about that. Just i was hurried and named it with the first thing i thought about๐ณ๐ณ
+ 2
Patel Ashish we solve it already๐
+ 1
*to have๐
+ 1
Well, check my code again, i remade it again ๐๐๐
+ 1
Thanks, i did it๐
0
Let me try it . Thanks
0
Try it. If that's the thing you wanna get๐ค
0
Thanks so much it so good to people like you
0
Hi Nazeek after some tinkering I managed to make add all integers up to n
https://code.sololearn.com/WX2Dfe1JckHG/?ref=app
0
Yeap, thats kinda smart๐ I think you can also do it available for users to choose a number. The easiest way is to use "prompt" i guess ๐ค๐ค
0
Iam still still a novice to be honest. I don't know how it's done
0
Nazeekk please, stop using expletives anywhere.
0
Wow๐
That's a function to get user input. Just like:
let x = prompt()
alert(x)
So here when we enter data, the "x" variable will have user's value
0
Nazeekk Let me incorporate that into my code thanks
0
Check my link again. I remade it๐๐ So.. as i can get, you made smth kinda "factorial calculator"?๐ค
0
Ok
0
Wow ๐ it works