#I just started using javascript. This is not working as intended, is there mistakes?
49 messages · Page 1 of 1 (latest)
?var
(Never use var)
You shouldn’t be declaring/assigning those variables at the top of the function. Use the parameters.
You see i am not understanding that. Can you help me?
Sorry the var is being used in my school examples. Should i be using Let?
Or const, yes.
#faq to learn modern JS. var is a relic of the past. Your teacher is out-dated.
I will let him know lol. thank you
ugh this stuff gives me headaches
so
can you give me an example of "use the parameters"
calcFunc(10, 20, 30)
ohhhhhhh
i am a idiot
thank you
quick question @fathom compass
is 10 not a number in javascript
it is
it is saying Unexpect number syntax erro
show your new code
function calcFunc(10,20,30) {
let a *= 10
return a
let b -=20
return b
let c = b + 30
return c
console.log(c)
}
module.exports = { calcFunc }
oh I bet you changed the function declaration instead of calling the funciton with those values
ya 😄
function calcFunc (num1, num2, num3) {
that part was correct.. you are defininig your function here.. after defining it, you need to call it
I suggest you read the link I pasted above
rip my soul
okay so what you are saying is to keep this js function calcFunc (num1,num2,num3) {
then i need to define js let num1 = 10; let num2 = 20; let num3 = 30;
no
python is way easier haha
fairly sure functions work the same in python
you define a function:
function myFunc (parameter1, parameter2, parameter3) {
return parameter1 + parameter2 + paramater3;
}
then you actually call that function:
myFunc(10, 20, 30);
if you read the link, it'll all make sense 🙃
Hey I really appreciate the help. even though its all basic. I did end up getting the correct answer
What i don't get is why my teacher is using broken terms that are outdated
ugh