Java Scrip
JavaScript, often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.
Here is what the above code is Doing:
1. We are creating a variable called `my_string` and assigning it the value of the string `”JavaScript, often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.”`
2. We are printing the value of `my_string` to the console.
### Exercise
Create a variable called `my_number` and assign it the value of the number `42`. Then print the value of `my_number` to the console.
### Exercise Solution
“`js
let my_number = 42;
console.log(my_number);
“`
## Variables
Variables are used to store data. In JavaScript, we use the `let` keyword to create a variable.
“`js
let my_variable = “Hello World!”;
“`
### Exercise
Create a variable called `my_name` and assign it the value of your name. Then print the value of `my_name` to the console.
### Exercise Solution
“`js
let my_name = “John Doe”;
console.log(my_name);
“`
## Data Types
In JavaScript, there are 7 data types:
1. String
2. Number
3. Boolean
4. Null
5. Undefined
6. Symbol
7. Object
### String
A string is a sequence of characters.
“`js
let my_string = “Hello World!”;
“`
### Number
A number is a numeric value.
“`js
let my_number = 42;
“`
### Boolean
A boolean is a value that is either `true` or `false`.
“`js
let my_boolean = true;
“`
### Null
Null is a value that represents nothing.
“`js
let my_null = null;
“`
### Undefined
Undefined is a value that represents a variable that has not been assigned a value.
“`js
let my_undefined;
“`
### Symbol
A symbol is a unique and immutable data type.
“`js
let my_symbol = Symbol();
“`
### Object
An object is a collection of properties.
“`js
let my_object = {
name: “John Doe”,
age: 42,
is_married: true
};
“`
### Exercise
Create a variable called `my_string` and assign it the value of the string `”Hello World!”`. Then print the value of `my_string` to the console.
### Exercise Solution
“`js
let my_string = “Hello World!”;
console.log(my_string);
“`
### Exercise
Create a variable called `my_number` and assign it the value of the number `42`. Then print the value of `my_number` to the console.
### Exercise Solution
“`js
let my_number = 42;
console.log(my_number);
“`
### Exercise
Create a variable called `my_boolean` and assign it the value of the boolean `true`. Then print the value of `my_boolean` to the console.
### Exercise Solution
“`js
let my