When I typed this apparently innocent snippet of code:
values.name
gedit highlighted name as a keyword. However,
This happened to me also, for example, the following didn't work for me while I was testing the call, bind functions.
var name={
firstname: 'Abhishek',
lastname: 'Agarwal',
fullname: function{
var fname = this.firstname + ' ' + this.lastname;
return fname;
}
function printname(){
console.log(this.fullname());
}
var final=printname.bind(name);
final();
This didn't actually perform the task and instead when I replaced "name" occurences by "myname" or literally anything else, it did work!
It's not a reserved word it's a variable (it is window.name) I'm not sure what it's defined by though.
(I know this was asked 2 years ago but, ...) This happened to me also, for example this below would not work.
name = document.getElementById('nombre');
//something else
name.className = 'thinking';
Instead I changed it to
username = document.getElementById('nombre');
//something else
username.className = 'thinking';
and it did work! Yeah, alright that's all, but it's something I find maybe quite interesting, also because of the 'name' attribute of the 'a' tag. Something to watch out for.
Its not a javascript reserved word, its an html attribute. Any DOM element can have a name. Looks like your syntax editor will still highlight it.