검색결과 리스트
글
출처 : http://jqfundamentals.com/book/index.html#chapter-1
var myFunction = function() {
console.log('hello');
};
var myObject = {
foo : 'bar'
};
var myArray = [ 'a', 'b', 'c' ];
var myString = 'hello';
var myNumber = 3;
typeof myFunction; // returns 'function'
typeof myObject; // returns 'object'
typeof myArray; // returns 'object' -- careful!
typeof myString; // returns 'string';
typeof myNumber; // returns 'number'
typeof null; // returns 'object' -- careful!
if (myArray.push && myArray.slice && myArray.join) {
// probably an array
// (this is called "duck typing")
}
if (Object.prototype.toString.call(myArray) === '[object Array]') {
// Definitely an array!
// This is widely considered as the most robust way
// to determine if a specific value is an Array.
}
'JavaScript > JavaScript' 카테고리의 다른 글
| [Javascript] Post 방식으로 Popup창 생성 (0) | 2011.12.13 |
|---|---|
| [Javascript] Dom Object를 동적으로 생성할때 객체 전달 방법 (0) | 2011.12.06 |
| [JavaScript] this에 대해서 (0) | 2011.05.27 |
| [javascript] Closures (0) | 2011.05.24 |
| iE와 Crome의 getAttribute메소드 차이 (0) | 2011.04.08 |

RECENT COMMENT