Notes/ Completing Code Hacks:

Data types- there are 8 JS data types.

List a few data types that you already know

  • String
  • Boolean

Write a boolean statement that outputs true

Boolean(9 > 1)
true

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
'Hello'

JavaScript in HTML- Questions

  1. 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)

  2. 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.

  3. 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.

  4. What tag do you use to write JavaScript code? You use script tags

Extra Credit: code a small JavaScript game

<!DOCTYPE html>

Tic Tac Toe JavaScript Game

Tic Tac Toe Game using