There are a zillion possible statements, but only a few core words from which most are built. Good IDEs (Integrated Development Environments) can help you figure out what words are available by "hinting" them as you type:
break case catch const do else eval false finally for function if in isNaN length let Math NaN name new return switch this throw true try typeof undefined var while with
This is not a complete list, and there are a bunch more related to documents in browsers and other special stuff. Notice some are standard english (if, false, true) and actually mean pretty much the same thing. Some are English words that don't mean the same thing (for, throw). Others are made up words (var, NaN). A few are two words crammed together (typeof, isNaN).
var myvar = +"12" //this is now a number, and it's value is 12 var myvar = "12"*1 //this is now a number, and it's value is 12 var myvar = "12"+0 //this is now a string, and it's value is "120"
myvar.length //tells us how long the value in myvar is. myvar.toString //contains a program that will convert myvars value to a string. myvar.toString() //gives us the result of calling that program; the value as a string
Prototypes: Special objects are templates for making new objects with the new keyword. By convention, these "prototypical" objects are named with a single capital leter followed by lower case, and the objects created from them are all lower case. The document object has a prototype called Document. A more useful example is let my_array = new Array.
Functions: Functions take in parameters, then do stuff to them with a program and return values. Functions are also just objects like anything else, and can be stored in other objects, or have other objects or variables stored in them.
|file: /Techref/language/java/script/basics.htm, 8KB, , updated: 2019/10/14 15:19, local time: 2019/12/7 02:16,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to techref.massmind.org!