var <varname> = - the classic. let <varname> = - the modern. const <varname> = - the unchanging <varname> = - the 'oops I made this global by not actually using one' window.<varname> = - the 'deliberate' global
At a guess, anyway... Been wracking my brains to back when I started with classic ASP and early JS in the likes of IE 6 and such, and this is all I can remember... but the brain's not what it used to be, so probably wrong :D
For clarification, <varname> = throws an error in 'strict mode' which means you can't use them inside type="module" scripts, as they are in strict mode by default (source: developer.mozilla.org/en-US/docs/W...).
Definitely - and that's one reason using 'strict' is a massively good thing to do :D Or, perhaps better, use TypeScript and benefit from a more deliberate variable declaration syntax.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
From humble beginnings at an MSP, I've adventured through life as a sysadmin, into an engineer, and finally landed as a developer focused on fixing problems with automation.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
var is not an assignment keyword. If anything, it is a declaration keyword. If you want another way to declare a global variable (in a browser) simply add an id to a DOM node.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
11 plus years* active enterprise development experience and a Fine art degree 🎨
var <varname> =- the classic.let <varname> =- the modern.const <varname> =- the unchanging<varname> =- the 'oops I made this global by not actually using one'window.<varname> =- the 'deliberate' globalAt a guess, anyway... Been wracking my brains to back when I started with classic ASP and early JS in the likes of IE 6 and such, and this is all I can remember... but the brain's not what it used to be, so probably wrong :D
For clarification,
<varname> =throws an error in'strict mode'which means you can't use them insidetype="module"scripts, as they are in strict mode by default (source: developer.mozilla.org/en-US/docs/W...).Definitely - and that's one reason using 'strict' is a massively good thing to do :D Or, perhaps better, use TypeScript and benefit from a more deliberate variable declaration syntax.
Very nice, can you guess the bonus and deprecated variable from js 1.8?
Nope :D I never followed the language definition that far back, I have to admit - and Googling the MDN releases isn't very helpful.
developer.mozilla.org/en-US/docs/A...
crazzy.
It's a shortcut for creating linked lists? I can see why it got deprecated. Looks like it was a mozilla only tooling...
I have no idea, I didn't stick around to find out. 😂
var, let and const
Incorrect. There are two more.
Global and
Sharp variables (
depreciateddeprecated)Deprecated*. Depreciation is what happens when things lose value.
Same thing 😅, damn auto correct.
Which ones?
Var ,let & const
Nope sorry read the comments for my cruel trick
varis not an assignment keyword. If anything, it is a declaration keyword. If you want another way to declare a global variable (in a browser) simply add anidto a DOM node.I'm not sure I follow, can you elaborate on why
varis not a means to assign a variable to a space in memory.Also not sure how a html attributes is a variable unless it has some special relationship that other attributes do not?
Happy to learn new things, not trying to be annoying.
Does 'this.value = value' count as keyword variable assignment?
Yes and no :) its a grey area.
var,let,const,global