Title
console.log("yippee");
var msg = "in this essay i will analyze the rhetorical appeals of the hit song mask by dream";
console.log(msg);
function logIt(output) {
console.log(output);
}
logIt(msg);
console.log("Reuse of logIT")
logIt("hello welcome to my essay");
logIt(2022)
function logItType(output) {
console.log(typeof output, ";", output);
}
console.log("looking at who asked")
logItType("no one"); // String
logItType(0); // Number
logItType([0, 0, 0]);
function Person(name, slayrate, classOf) {
this.name = name;
this.slayrate = slayrate;
this.classOf = class0f;
this.role = "";
}
// define a setter for role in Person data
Person.prototype.setRole = function(role) {
this.role = role;
}
// define a JSON conversion "method" associated with Person
Person.prototype.toJSON = function() {
const obj = {name: this.name, slayrate: this.slayrate, class0f: this.classOf, role: this.role};
const json = JSON.stringify(obj);
return json;
}
// make a new Person and assign to variable teacher
var slayer = new Person("sabine", "1million", 2024); // object type is easy to work with in JavaScript
logItType(slayer); // before role
logItType(slayer.toJSON()); // ok to do this even though role is not yet defined
// output of Object and JSON/string associated with Teacher
slayer.setRole("slayer"); // set the role
logItType(slayer);
logItType(slayer.toJSON());