Last active
March 22, 2017 13:38
-
-
Save ppraksa/b07eb678f85350be4812f1b18496880d to your computer and use it in GitHub Desktop.
"to hoist or not to hoist"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cat = new Cat() // it's ok ! | |
cat.sayHello(); // then we call sayHello without any problem! | |
function Cat() { | |
this.sayHello = function() { | |
console.log('hello Im a cat'); | |
} | |
} | |
var dog = new Dog(); // ref error wtf? | |
dog.SayHello(); | |
class Dog { | |
sayHello() { | |
console.log('hello Im a dog'); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment