reading-notes

Code Fellows Notes

View project on GitHub

JAVASCRIPT!

Javascript is a programming language that allows your to make web pages interactive. It improves the users experience by making a static web page an interactive web page.

Variables

there are three commands to set variables.

  • var
  • let
  • const

    var

using the var command you set or declare a variable. at this point the variable has no value it is just a placeholder for a variable to come.
var yourname; declares yourname as the variable but it contains nothing.
yourname = "bob" gives the variable yourname the value of bob. you can also name a variable or several variables and also give them values at the same time.
var yourname = "bob", yourlname = "smith"

variable values can be text or numbers or text with numbers but they are treated differently.

when giving value to a declared variable, “text” will be wrapped in "", this is called a string. numbers can also be written in "" but they will no long be recognized as numbers. Numbers need to be without "" as in, `var age = 41; this declares age as the variable and 41 as a number value for age.

A variable without a value is considered value undefined. Sometimes a variable will remain undefined because it requires a users imput to define the value.

let

the let variable acts differently to the var variable. using the var variable you are able to over wright the value of a declared variable whether it is dont by accident or on purpose. Let does not allow this. Once a let variable is given a value that value can not be redefined.

main