0

Why var is not working outside the scope?

Check the code.I assume var is behaving like let.It is not defining the variable outside the scope/function. https://code.sololearn.com/Wu5kwmDF2UKS/?ref=app

28th Aug 2022, 7:03 AM
Riyad Rahman [ŌĬ©]
Riyad Rahman [ŌĬ©] - avatar
2 Respuestas
0
I suppose, It doesn't work, because variable not global. It is declared inside the function
29th Aug 2022, 2:27 PM
–ē–≤–≥–Ķ–Ĺ–ł–Ļ –ú–ĺ–Ľ–ī–ĺ–≤–į–Ĺ–ĺ–≤
–ē–≤–≥–Ķ–Ĺ–ł–Ļ –ú–ĺ–Ľ–ī–ĺ–≤–į–Ĺ–ĺ–≤ - avatar
0
You can use "const" or declare a variable outside of a function to fix your code, good luck:)
29th Aug 2022, 2:29 PM
–ē–≤–≥–Ķ–Ĺ–ł–Ļ –ú–ĺ–Ľ–ī–ĺ–≤–į–Ĺ–ĺ–≤
–ē–≤–≥–Ķ–Ĺ–ł–Ļ –ú–ĺ–Ľ–ī–ĺ–≤–į–Ĺ–ĺ–≤ - avatar