View on GitHub

reading-notes

My Reading Notes for Code Fellows Class

Dynamic web pages with JavaScript

JS Intro Paragraph

prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative

JavaScript is NOT Java

scripting language that enables you to create dynamically updating content, control multimedia, animate image

const para = document.querySelector(‘p’);

para.addEventListener(‘click’, updateName);

function updateName() { const name = prompt(‘Enter a new name’); para.textContent = Player 1: ${name}; }

Input and Output in JS

examples/js/pure_js_greating.html

Hello World First name: Last name:

With a button,a div element, two input elements and each one with its own ID

Variables

4 Ways to Declare a JavaScript Variable:

Variables store values, like in algebra:

let x = 5; let y = 6; let z = x + y;

Use var when code is 1995 to 2015

Use let and const post 2015

const is the go to unless chnaging value of variable

const price1 = 5; const price2 = 6; let total = price1 + price2;

Identify variables with unique names, a must; case sensitive.

Declare variables at begginnig of script

seperate variables with ,

Re-declare variable, lose value!

You can use = and +

$ and _ treat as variables