University of Sydney_INFO1003_Foundamental of IT_2012 Semester 2
26/08/2012
Naming Variables Give each variable name, a meaningful name. The previous variable abc is a bad example. Bad names include:- S, c, n, a, av, somevar, myvar, this, that, blah, foo
Good names include:- firstName, myAddress, meanGrade - Good variable names should describe the data being stored.13
JavaScript Operators Operators are used to operate on values.Operator+ */% Description Addition Subtraction Multiplication Division Modulus (division remainder) Increment (by one) Decrement (by one) Example var x=2; x= x+2; var x=2; x= 5-x; var x=4; x= x*5; var x= 15; x= 15/ x; var x= 5%2; var x= 10%8; var x= 10%2; var x=5; x++; var x=5; x--; Value of X 4 3 20 1 1 2 0 6 4
++ --
14