JS Lesson Hacks
Hacks!!
Write a boolean statement that outputs true
Boolean(9 > 1)
Edit/add to the code above so that it outputs "Hello World"
const myObject = {
'Hello World'
};
console.log(myObject);
Object
- Identify the name/keys in the object below: Elly, Rottweiler, 4
- Identify the values in the object below: name, breed, age
Create a conditional statement about how you would greet someone based on the time of day.
let greeting = 54
if (present = true) {
cast = "Hello";
}
else {
cast = "Bye";
}
cast
JavaScript in HTML- Questions
-
Where do you store the JavaScript Code? You can store it in a js file and the name of the file mustt end in js. (ex. example.js)
-
How do you import a JS file into HTML? Either you import it from an external js file or you just imbed it into the html file using script tags.
-
What is onClick? It is the push of a button. When you use onclick, the whenever you push a button that uses this there is supposed to be some output that comes out after pressing the button, which is a result of the onclick function.
-
What tag do you use to write JavaScript code? You use script tags
<!DOCTYPE html>