Learn JavaScript Correctly | Cheatsheet


1. Data Types

  1. String          // "Any text"
  2. Number      //  1345
  3. Boolean      //  true or false
  4. Null             //null
  5. Undefined   // undefined
  6. Symbol       //Symbol('something')
  7. Object          // { key : 'value' }
    1. Array       // [23,"text",true]
    2. Function   // function name(){}

2. Basic Vocabulary

 Variable

In the following example, A named reference to a value is a variable.

Example 
        
        var a = 10 + "2";

Operator

Operators are reserved-words that perform action on values and variables. 
Example : + - = * in === typeof !=..

Keyword/reserved word

Any word that is part of the vocabulary of the programming language is called a keyword it is also known as a reserved word
Example: var = + if for ...

Expression 

A reference, value, or a group of reference and value combined with the operator, which results in a single value.

Statement 

A group of words, numbers, and operators that do a task is a statement.

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.

Example:


    let user = {
        name: 'HTML Space Code',
        address: 'Kathmandu',
        yearOfBirth: 2019,
        doSomething: function () {
            //do something
        }
    }

Key

name, address, yearOfBirth, and doSomething are the keys in the user object.



    let user = {
        name: 'HTML Space Code',
        address: 'Kathmandu',
        yearOfBirth: 2019,
        doSomething: function () {
            //do something
        }
    }

Value

HTML space code, Kathmandu, 2019, and function are the values of respective keys in the user object.


    let user = {
        name: 'HTML Space Code',
        address: 'Kathmandu',
        yearOfBirth: 2019,
        doSomething: function () {
            //do something
        }
    }


Method 

If a key has a function as a value, it is called a  method.

    
        doSomething: function () {
            //do something
        }

Reactions

Post a Comment

0 Comments