Day 2 Monday - Code from Lab work

Welcome to Siddharth, Mae, Bao-An, Ryan, Sitra, Hoyong, and Janet, who meet Mondays and Wednesdays, (but no class on January 21st ) in January of 2019 at Collin College, the courtyard campus to learn how to READ JavaScript code -- plus we learn some programming. JavaScript forms the basic Language of the web; it's the glue between the HTML and CSS actions that form the Transformation in a browser or API call.
Post Reply
User avatar
james
Posts: 132
Joined: Mon Apr 16, 2018 1:03 pm

Day 2 Monday - Code from Lab work

Post by james » Wed Jan 16, 2019 4:24 pm

Here is the html file:

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <h1>This is my first js program</h1>

<hr>

<h2>this is an interesting class</h2>

<script src="./index.js"></script>

</body>
</html>
Here is the JS file:

Code: Select all

 //this is a silly bunch of code

 //var firstName = 'james';

 //console.log(x);
 
 // names cant' be reseved word.
 // meaningful ...
 // no spaces or - 
 // cant start with a number 

 //let firstName ="james", lastname="Canavan";

 //console.log( firstName , lastName);

 let person = {

     name: "james",
     eyes: "blue",
     age : 45

 };


console.log(person);

console.log(person.name);

let selectedColor = [ "red" , "blue"];

console.log(selectedColor);

console.log(selectedColor.length);
Yeah.... but that code output is sort of difficult to read. Basically this bit of code was introduced:

let person = {

name: "james",
eyes: "blue",
age : 45

};


console.log(person);


Now... there's one other Object type we can look at that's very similar: The Array.

let selectedColor = [ "red" , "blue"];

console.log(selectedColor);

console.log(selectedColor.length);



Post Reply