1. Data Types
- String
"Any text"
- Number
12345
- Boolean
true or false
- Null
null
- Undefined
undefined
- Symbol
symbol('something')
- Object
{key: 'value'}
- array
[1,"text", false]
- function
function name(){}
- array
number 1-6 are six primitive types
2. Basic Vocabulary
var a = 7 + "2";
var = keyword/reserved word
any word that is part of the vocabulary of the programming languange is called a keyword(a.k.a reserve word).
Example: var = + if for...
a = variable
a named reference to a value is a variable
= and + = operator
operators are reserved-words that perform action on values and variables
Example: + - = * in === typeof != ...
var a = 7 + "2"; = statement
a group of words, numbers and operators that do a task is a statement
7 + "2" = expression
a reference, value or a group of reference(s) and value(s) combined with operator(s). which result in a single value.
3. Object
An object is a data type in Javascript that is used to store a combination of data in a simple key-value pair.
var user = {
name: "Lourdes Suello",
yearOfBirth: "1991"
calculateAge: function(){
// some code to calculate age
}
}
name, yearOfBirth, calculateAge
= Key
these are the keys in user object.
"Lourdes Suello", "1991", function(){}
= Value
these are the values of the respective keys in user object.
function(){}
= Method
if a key has a function as a value its called a method
4. Function
A function is a simple bunch of code bundled in a section. This bunch of code ONLY runs when the function is called. Functions allow for organizing code into section and code reusability.
Top comments (0)