oreonetworking.blogg.se

Does not equal sign js
Does not equal sign js











JavaScript is a C-based language developed in 1995. So the question then is naturally: why did the spec for one choose assignment operator to be equals and the other a colon for nearly the same idea? You're kinda asking why "cat = gato" isn't just "cat = cat" - the grammar and spelling of the two specs being different is definitely something that is a possibility, so it shouldn't be *such* a surprise right off the bat.

does not equal sign js

These are two different specs, and they serve two different purposes. JSON's spec says the colon will be used to denote key/value pairs. JavaScript's spec says the equal sign will be used as an assignment operator. I then have to turn something that looks likeĮveryone is providing really technical examples but I think an analogy and history would be better. As the functionality grows I might add some more variables and then at some point it'll look like it may be handier to have them in an object (which may, further down the road, grow into a class).

#DOES NOT EQUAL SIGN JS CODE#

I'll start with some code which sets up some variables and then go on to use them. I'd go further and say that it doesn't need to use commas instead of semicolons to terminate a property initialisation.įor me, this crops up every now and then when I'm coding a new area of functionality.

does not equal sign js

The parsing would work whichever token was used. I have no answer to "Why?" but I can also see no reason why the syntax for object initialisation has to use colons instead of equals. Sense.įuzzybabybunny is a novice javascripter and I'm a veteran javascripter and we both think alike on this.

does not equal sign js

The question was "Why does javascript they require it this way?", coupled with the observation that it Just. My fellow bunny didn't ask "What am I doing?" or "How do I do this?".











Does not equal sign js