Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Class updates
  • Loading branch information
drm10001 committed Feb 24, 2020
1 parent c7157c1 commit 9c1c041
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions intermediate.js
Expand Up @@ -33,5 +33,57 @@ var personInfo = {
}
};

//JSON
var json = {
"firstName": "Joe",
"lastName": "Smith",
"state": "CT"
};

JSON.stringify(personInfo);

console.log(personInfo.firstName);
console.log(personInfo.fullName());

var array = ["CT", "MA", "NY", "RI", "NH", "VT", "ME"];

console.log(array.length);

var name = "Frank";
var length = name.length;

array.push("PA");
console.log(array);

array[0]; // "CT"
array[3]; // "RI"
delete array[1];
console.log(array);
array.splice(1, 1);

// var array = ["CT", "MA", "NY", "RI", "NH", "VT", "ME"];

//foreach
array.forEach(function(item) {
console.log(item + "!");
})

//DATES
personInfo.createdDate = new Date();

var date = new Date();
console.log(date);

var stringDate = new Date("02/24/2020");
var something = new Array();

//Try/Catch

try {
if(something.length > 0) {
alert('The array exists');
}
} catch {
console.log("There was an error in your try/catch");
}

0 comments on commit 9c1c041

Please sign in to comment.