/headfirst-js

Headfirst book initial repo.

Primary LanguageJavaScript

##The variable without equsl sign : We say optionally, because if you want, you can create a variable without
an initial value, and then assign it a value later. To create a variable
without an initial value, just leave off the assignment part, like this:

##A variable can hold are numbers string and the bollean values.

##What’s a keyword?
A: A keyword is a reserved word in
JavaScript. JavaScript uses these reserved
words for its own purposes, and it would
be confusing to you and the browser if you
started using them for your variables.

##Q: What exactly is a block of code?
A: Syntactically, a block of code (which
we usually just call a block) is a set of
statements, which could be one statement,
or as many as you like, grouped together
between curly braces. Once you’ve got a
block of code, all the statements in that
block are treated as a group to be executed
together. For instance, all the statements
within the block in a while statement are
executed if the condition of the while is true.
The same holds for a block in an if or else if.  
eg {
}


## What is psecdocode and how it works.
DECLARE three variables to hold the location of each cell of the ship. Let’s call them
location1, location2 and location3.
DECLARE a variable to hold the user’s current guess. Let’s call it guess.
DECLARE a variable to hold the number of hits. We’ll call it hits and set it to 0.
DECLARE a variable to hold the number of guesses. We’ll call it guesses and set it to 0.
DECLARE a variable to keep track of whether the ship is sunk or not. Let’s call it isSunk
and set it to false.

##If you don’t provide an initial
value for a variable, then
JavaScript gives it a default value of
undefined. Think of the value undefined
as JavaScript’s way of saying “this variable
hasn’t been given a value yet.”

If we click cancel in in the prompt dialog box the value returns null.

##Comparison Operators
Comparison operators compare
two values. Here are some common
comparison operators:
<
>
==
===
<=
>=
!=
means “less than”
means “greater than”
means “equal to”
means “exactly equal to” (we’ll
come back to this one later!)
means “less than or equal to”
means “greater than or equal to”
means “not equal to”

let buyIt = (inStock || onSale);
let buyIt = (inStock && onSale);

true true = true // true
true false = true // false
false true = true // false
false false = false //false

var randomLoc = Math.floor(Math.random() * 5);
We can use Math.floor to round down all these
numbers to their nearest integer value.


Let conisderes a postive number as #true# and a negative number as #false#
##OR operator taken as *plus* and && Operator is taken as *Multiply*



**The seven laws**

Be honest to yourself
Be faithful in small things
Be persistant in your efforts and never give up hope.

begin the day with a plan and end with a review
code, Test, commit a new program for 100 days without a break


Remember, to the one who has more will be given.
Remember, freely you have recived, freely you give