ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Introduction to JavaScript
    JavaScript 2021. 10. 7. 23:06

    이 글은 JavaScript의 조건문이나 반복문 등 주요 개념을 배우기 전,
    기본 문법 및 바탕이되는 개념사항들을 정리하
    기 위해 작성하였습니다.

     

     


     

    < Console >

    A panel that displays important messages, like errors, for developers.

    Data is printed, or logged, to the console withconsole.log()

     

    ex)

    console.log(22)   //   22

     


    < Comments >

    To leave notes in our code for other developers or ourselves.

    Computer will ignore it as our program runs.

     

    • Single line comment  =>  Use  //
    • Multi-line comment  => Use  /*  */

     

    ex)

    // Print 5 to the console
    console.log(5);
    
    /*
    Print 5 to the console
    please write "console.log(5);"
    */
    console.log(5);

     


    < Data Types >

    Data Types are the classifications we give to the different kinds of data that we use in programming.

    In JavaScript, There are seven fundamental data types

     

    • Number : Any number, including numbers with decimals  =>  ex) 4, 8, 15.16
    • String : Any grouping of characters on your keyboard (letters, numbers, symbols, etc.) 
        =>  Use ' ... ' or " ... "
    • Boolean : Only has two possible values  =>  true or false
    • Null : This data type represents the intentional absence of a value  =>  represented by the keyword null
    • Undefined : It also represents the absence of a value though it has a different use than null
        =>  denoted by the keyword undefined
    • Symbol
    • Object : Collectors of related data.

     


    < Arithmetic Operators >

    • Add : +
    • Subtract : -
    • Multiply : *
    • Divide : /
    • Remainder : %

     


    < String Concatenation >

    • 'A' + 'B' = 'AB'

     

    ex)

    'Hello ' + 'World!'   //   'Hello World!'

     


    < Properties >

    To store data for an object

    be called by the object or instance,  dot operator(.) property

     

    ex)

    'hello'.length   //   5

     


    < Methods >

    Actions we can perform.

    be called by the object or instance dot operator(.),  property,  opening and closing parentheses

     

    ex)

    'hello'.toUpperCase()   //   'HELLO'

     


    < Built-in Object >

    Collections of methods and properties that JavaScript provides

     

    ex)

    // Use Math object
    
    console.log(Math.random());   //   prints a random number between 0 and 1
    Math.floor(45.2);   //   45

    'JavaScript' 카테고리의 다른 글

    Arrays  (0) 2021.10.14
    Scope  (0) 2021.10.12
    Functions  (0) 2021.10.11
    Conditionals  (0) 2021.10.09
    Variables  (0) 2021.10.08

    댓글

Designed by Tistory.