ES2015 에 대하여

JavaScript 2016. 3. 3. 16:01

JavaScript 의 새로운 표준으로 ES2015 가 뜨고 있다. 그래서 웹에서 ES2015 에 대하여 검색해봤더니 아래와 같은 정보를 찾을 수 있었다.


JavaScript 표준안http://www.ecma-international.org/ecma-262/6.0/


ES2015 바뀐 내용https://babeljs.io/docs/learn-es2015/


Node.js 에서 지원하는 최신 JavaScript 기능https://nodejs.org/en/docs/es6/



'JavaScript' 카테고리의 다른 글

Promise 사용법  (0) 2015.12.21
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
Function 객체의 Methods 소개  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,

Promise 사용법

JavaScript 2015. 12. 21. 14:19


'JavaScript' 카테고리의 다른 글

ES2015 에 대하여  (0) 2016.03.03
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
Function 객체의 Methods 소개  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,

var array = [2, 5, 9];


var key = 3;

console.log('\nData : ' + key);                                  // Data : 3

console.log(array.indexOf(key) + ' : ' + ~array.indexOf(key));   // -1 : 0

console.log(array.indexOf(key) + ' : ' + !~array.indexOf(key));  // -1 : true

console.log(array.indexOf(key) + ' : ' + !array.indexOf(key));   // -1 : false


key = 2;

console.log('\nData : ' + key);                                  // Data : 2

console.log(array.indexOf(key) + ' : ' + ~array.indexOf(key));   // 0 : -1

console.log(array.indexOf(key) + ' : ' + !~array.indexOf(key));  // 0 : false

console.log(array.indexOf(key) + ' : ' + !array.indexOf(key));   // 0 : true


key = 9;

console.log('\nData : ' + key);                                  // Data : 9

console.log(array.indexOf(key) + ' : ' + ~array.indexOf(key));   // 2 : -3

console.log(array.indexOf(key) + ' : ' + !~array.indexOf(key));  // 2 : false

console.log(array.indexOf(key) + ' : ' + !array.indexOf(key));   // 2 : false


'JavaScript' 카테고리의 다른 글

ES2015 에 대하여  (0) 2016.03.03
Promise 사용법  (0) 2015.12.21
Function 객체의 Methods 소개  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,

1. Function.prototype.apply()

  : 함수를 호출하는데 this 값을 지정된 객체로 대체하고 매개변수를 배열로 전달 한다.

apply([thisObj[,argArray]])


2. Function.prototype.call()

  : 함수를 호출하는데 this 값을 지정된 객체로 대체하고 매개변수를 순서대로 전달 한다.

call([thisObj[,arg1[,arg2[,..,argN]]]])


3. Function.prototype.bind()

  : this 값이 지정된 함수를 생성하며, 초기 매개 변수를 지정 할 수 있다.

function.bind(thisArg[,arg1[,arg2[,...,argN]]])


'JavaScript' 카테고리의 다른 글

ES2015 에 대하여  (0) 2016.03.03
Promise 사용법  (0) 2015.12.21
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,

public class Person

{

    public string Name { get; set; }

    public DateTime Birthday { get; set; }

}


Person person = new Person { Name = "Bob", Birthday = new DateTime (1987, 2, 2) };

string output = Newtonsoft.Json.JsonConvert.SerializeObject (person);

Console.WriteLine (output);

Console.WriteLine();


person = Newtonsoft.Json.JsonConvert.DeserializeObject<Person> (output);

Console.WriteLine ("{0} - {1}", person.Name, person.Birthday);


string json = @"{ Name: 'Bob', HairColor: 'Brown' }";

var bob = Newtonsoft.Json.Linq.JObject.Parse (json);


Console.WriteLine ("{0} with {1} hair", (string)bob["Name"], (string)bob["HairColor"]);


참고> https://components.xamarin.com/gettingstarted/json.net


'JavaScript' 카테고리의 다른 글

ES2015 에 대하여  (0) 2016.03.03
Promise 사용법  (0) 2015.12.21
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
Function 객체의 Methods 소개  (0) 2015.11.23
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,

var config = {

    Redis: {

        Host: 'LocalHost'

    }

}


//-------------------------------------------

var a = config.Redis;

var b = config.Chat;


console.dir(a);     // { Host: 'LocalHost' }

console.dir(b);     // undefined


//-------------------------------------------

var c = config.Redis || 'Redis';

var d = config.Chat  || 'Chat';


console.dir(c);     // { Host: 'LocalHost' }

console.dir(d);     // 'Chat'


//-------------------------------------------

var e = config.Redis && 'Redis';

var f = config.Chat  && 'Chat';


console.dir(e);     // 'Redis'

console.dir(f);     // undefined


//-------------------------------------------

var g = config.Redis && config.Redis.Host;

var h = config.Chat  && config.Chat.Port;


console.dir(g);     // 'LocalHost'

console.dir(h);     // undefined


//-------------------------------------------

var i = (config.Redis && config.Redis.Host) || 'google.com';

var j = (config.Chat  && config.Chat.Port)  || 80;


console.dir(i);     // 'LocalHost'

console.dir(j);     // 80


'JavaScript' 카테고리의 다른 글

ES2015 에 대하여  (0) 2016.03.03
Promise 사용법  (0) 2015.12.21
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
Function 객체의 Methods 소개  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
Posted by jungtae17
,