-
Notifications
You must be signed in to change notification settings - Fork 0
JavaScript
It was developed in 10 days by Brendan Eich for netscape navigator, one of the first internet browsers
JavaScript was created in 1995 by Brendan Eich while he was an engineer at Netscape. JavaScript was first released with Netscape 2 early in 1996. It was originally going to be called LiveScript, but it was renamed in an ill-fated marketing decision that attempted to capitalize on the popularity of Sun Microsystem's Java language — despite the two having very little in common. This has been a source of confusion ever since.
JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages — many structures from those languages apply to JavaScript as well. JavaScript supports object-oriented programming with object prototypes, instead of classes. JavaScript also supports functional programming — functions are objects, giving functions the capacity to hold executable code and be passed around like any other object.
you can declare all of the variables at the top and then don't have to reuse the var keyword
var year, yearJohn, yearMark;
each variable needs to have a value assigned to it arithmetic operators
now = 2018;
ageJohn = 28;
ageMark = 33;
console.log(ageJohn);
console.log(now + 2);
console.log(now * 2);
console.log(now / 10);
Relational operators test for a relationship between two values then will return true or false depending on whether that relationship exists. They always evaluate to a boolean value.
NOTE: string comparison is case sensitive and all capital ASCII are "less than" lowercase ASCII letters. For example Zoo < aardvark
Test the relative order of their two operands (
evaluates to true if its first operand is less than its second operand; otherwise it evaluates to false
evaluates to true if its first operand is greater than its second operand; otherwise it evaluates to false
evaluates to true if its first operand is less than or equal to its second operand; otherwise it evaluates to false
evaluates to true if its first operand is greater than or equal to its second operand; otherwise it evaluates to false
Javascript will convert the data type as it is needed so for example:
var firstName = 'John'; //string literal
var age = 28; //number
console.log(firstName + ' ' + age);
In the console, the var age is converted and the both will display as strings.
or
var job, isMarried;
job = 'teacher';
isMarried = false;
console.log(firstName + ' is a ' + age + 'year old' + job + '.Is he married?' + isMarried);
will also display as a string