Javascript
------------------------------
Variable declaration: Var A;
Variable assignment: var a = 12;
function declaration: var mawesomefunction = function myargument) {}
Function call: Mawesomefunction (something);
function as a function parameter passed into another function
Declaring a function 1 square = function (a) {return a * A;}
Declaring a function 2 applyoperation = function (f,a) {return F (a);}
Call function 2 to pass function 1 as a parameter into function 2
Applyoperation (square,10);
return value
MyFunction = function (a) {
return A;
Explodecomputer (); This sentence because the last sentence has return will not execute}
IF
if (foo) {return bar;}
If/else
if (foo) {function1 ();}
else {function2 ();}
If/else conditional judgment as a line
Foo? Function1 (): function2 ();
If Foo is established return function1 function otherwise return function2 function
Variable Assignment Example: var n = foo? 1:2;
"When Foo is true, the value of n is assigned to 1, otherwise it is 2
Else If to handle more types of judgments
if (foo) {function1 ();}
else if (bar) {function2 ();}
else {Function3 ();}
Javescript Arrays (Array)
Array declaration a = [123,456,789];
Array access a[1]; Returns 456
Javescript Objects (object)
Myprofile = {
Name: "Jare Guo",
Emmail: "[email protected]",
"Zip Code": 123456,
Isinvited:true}
Key is the property name and value is the property value
Gjm:javascript Language Learning Notes