Please enable JavaScript.
Coggle requires JavaScript to display documents.
javascript (basic of javascript (Objects and the Dom (DOM (document is the…
javascript
basic of javascript
-
Code Style
white space does not matter, but try not to have white space
-
-
-
Variables and Constants
-
-
var
not recommended, old style
Types and operators
-
-
-
-
null and undefined
-
-
Always use "null", never use "undefined"
-
Program Flow
Condition
-
-
-
== will convert types, very confusing, try not to use "=="
-
-
-
-
-
Objects and the Dom
Object Properties
let person = {
name: 'jone',
age:32,
partTime: false};
-
-
Object Methods
let person = {
name: 'John',
showInfo: fuction(){
showMessage(this.name);}
}
-
-
-
Detecting Button Clicks
const button = document.getElementById('see-review');
button.addEventListener('click', function(){
console.log('click');
});
-
Arrays
-
-
-
-
Slice() and Splice()
let values = [1,2,3];
values.slice(1,2);
-
values.splice(1, 0, 'foo') ;
start element, number of the delete element, insert value
-
-
-
-
-