There are 6 data types in JavaScript:
These are referred to as primitives i.e. they are what they are, you can't manipulate them the way you can their object counterparts (below.)
There are 6 data types in JavaScript:
These are referred to as primitives i.e. they are what they are, you can't manipulate them the way you can their object counterparts (below.)
What if we want to create a string using statically typed text and variables together?
There are two ways:
var myName = "Ryeker";
alert('Hello, ' + myName + '!'); //ES5
alert(`Hello, ${myName}!`); //ES6
We will be using ES6-style string interpolation.
In order to understand the rest of this day's examples, you'll need to grasp the concept of a "block" of code.
var, let, const: the variable types
I mentioned on day 1 that JavaScript is "Object Oriented." But what does that mean?
There are many ways to interact with your users. Here are the basic 3:
These are all functions. What's that?
We will get much deeper into functions in the following class sessions, but for now, understand a function is nothing more than some grouped JavaScript behavior that performs a specific set of actions. You call a function. It returns a value.
* Extra points if you use JavaScript's Date object for the birthday.