JavaScript will assume let to be a function, instead of a keyword, which is what you actually want it to be interpreted as.
Remove the parentheses enclosing what comes after let, and it will work.
let name1 [= value1] [, name2 [= value2]] [, ..., nameN [= valueN];
Solution 2 :
Seems like you are setting your variable wrong. When setting variables you want to use the = operator without the ()
Old: let(js = 'Amazing');
New: let js = 'Amazing';
Solution 3 :
let js = 'Amazing';
if (js === 'Amazing') {
alert('JavaScript is Fun!');
}
replace your script code with this.
Problem :
I am just a beginner, learning code from an online Bootcamp. The tutor gave us a prewritten code in which we just had to add a few lines using Visual Studio Code and open that file in Google Chrome But My browser is not showing the changes I have made in Code even though I have done exactly similarly as shown in the tutorial by the tutor. Please check the code and give me your insight. Thank You (do read the Note at the end of the code).
NOTE:
(This code does not open in Chrome. chrome only shows “JavaScript Fundamentals – Part 1” instead of the pop up “JavaScript is Fun”)
Comments
Comment posted by mason
Did you check your browser’s debug console for errors? That’s the first place you should look if you have JavaScript code that’s not working as expected. Are you absolutely certain the code you’ve copied matches what the bootcamp is showing you?
Comment posted by Alan Omar
use
Comment posted by Rateb Habbab
When you define a variable in javascript don’t use ‘()’. Just:
Comment posted by Fraz Zahid
Thank You so much, I rechecked it at least 10 times still the parenthesis was overlooked by me.
Comment posted by Fraz Zahid
Thanks for the information 🙂
Comment posted by Fraz Zahid
Thank You. I will keep this in mind 🙂
Comment posted by Aziza Kasenova
you can use formatting to format your answer to look a bit more friendly 🙂