TypeScript


미니맵


툴바


기능 확장


테마


'Atom 에디터' 카테고리의 다른 글

tsconfig.json 파일을 생성하는 메뉴 추가하기  (0) 2015.12.01
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
,