JS/JavaScript

[JS] 02. SyntaxBasic

밍글링글링 2017. 8. 28.
728x90

02_SyntaxBasic.js

/******* Comments *******/
// Single-and multi-line comments.
// Thie is an example of a single-line comment.
/*
* this is an example
* of a
* comment.
*/
/************/

/******* Whitespace *******/
//Whitespace is insignificant. Whitespace is also ignored in JavaScript.
var hello = "Hello";
var world       =      "World";

//Semantic whitespace promotes readability.
//Readable code is good!
var foo = function() {
    for(var i = 0; i < 10; i++){
        alert(i);
    }
};

foo();
/**************************/

/******* Identifiers *******/
//Valid indentifier names.
var myAwesomeVariable = "a";
var myAwesomeVariable2 = "b";
var my_awesome_variable = "c";
var $my_AwesomeVariable = "d";
var _my_awesome_variable_$ = "e";
/***************************/

/******* Variable Definition *******/
//This works;
var test = 1;
var test2 = function() { };
var test3 = test2(test);

//And so does this;
var x;
x === undefined; //true
/***************************/
 

728x90

'JS > JavaScript' 카테고리의 다른 글

[JS] 05. Conditional_Code  (0) 2017.08.28
[JS] 04. Operator  (0) 2017.08.28
[JS] 03. Type  (0) 2017.08.28
[JS] 01. Running code  (0) 2017.08.28
[JAVASCRIPT] JavaScript(자바스크립트) 이벤트  (0) 2017.08.01

댓글