# Typeof & Instanceof

## Typeof

```javascript
typeof 123; // number
typeof 'jartto'; // string
typeof !!’0’; // boolean
typeof new Function(); // function
typeof name; // undefined


let arr = [1,2,3];
let obj = {name: 'jartto'};
let obj1 = null;
typeof arr; // object
typeof obj; // object
typeof obj1; // object
```

## Instanceof

```javascript
function Parent(){};
function Child(){};
function Other(){};

Child.prototype = new Parent();
let child = new Child();

child instanceof Child; // true
child instanceof Parent; // true
child instanceof Object; // true
child instanceof Other; // false
```

## Reference

{% embed url="http://jartto.wang/2019/01/17/js-typeof/'" %}
