Created
December 6, 2020 02:20
-
-
Save 911992/9e277b66f24c446b22a5817e72b8009b to your computer and use it in GitHub Desktop.
Javascript object function overriding example
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
function get_obj(){ | |
var obj={ | |
func:function(){ | |
console.log("Tehc"); | |
} | |
}; | |
return obj; | |
} | |
var a = get_obj(); | |
a.func(); | |
a.func = function(){ | |
console.log("Hac"); | |
}; | |
a.func(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment