-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotesonJavascript.txt
More file actions
27 lines (24 loc) · 1.02 KB
/
NotesonJavascript.txt
File metadata and controls
27 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1. All numbers are floats
2. You cannot use numeric operators with strings and numbers (“Bob” x 4)
3. Javascript does not use destructive methods generally - it returns a new object
4. If you do not put ‘var’ before a variable definition, the variable will be global
5. var and functions are defined in turtleCase
6. No string interpolation
7. No implicit return value; need explicit return
8. === is comparison operator vs == in Ruby
9. No ‘unless’ && ‘else if’ not ‘elsif’
10. Cannot access from the end of an array using negative index
11. No first, last, or empty methods for arrays - use length
12. No shovel << operators for arrays - use push & pop or shift & unshift
13. No hash BUT object literal
14. Properties are like attr_accessors
15. Only ‘for’, ‘do’, ‘while’ loops
16. ‘for’ loop syntax:
for (var i = 0; i < n; i++) {
// block of code
}
OR
for (i in nums) {
console.log(i);
}
1. Callback functions (functions passed as arguments to other functions)