Created
January 28, 2019 16:07
-
-
Save suddeb/7e0680e17584f71f4eb014edd778bc36 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/vocijix
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
//Property name at declaration | |
var student = { | |
"name":"Sudipta Deb" | |
} | |
//This will throw an error as the function is not yet defined. | |
student.sayFullName(); | |
//Let's add the function as runtime | |
student.sayFullName = function(){ | |
console.log('FullName: ' + this.name); | |
} | |
//This time it will print the fullname | |
student.sayFullName(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">//Property name at declaration | |
var student = { | |
"name":"Sudipta Deb" | |
} | |
//This will throw an error as the function is not yet defined. | |
student.sayFullName(); | |
//Let's add the function as runtime | |
student.sayFullName = function(){ | |
console.log('FullName: ' + this.name); | |
} | |
//This time it will print the fullname | |
student.sayFullName();</script></body> | |
</html> |
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
//Property name at declaration | |
var student = { | |
"name":"Sudipta Deb" | |
} | |
//This will throw an error as the function is not yet defined. | |
student.sayFullName(); | |
//Let's add the function as runtime | |
student.sayFullName = function(){ | |
console.log('FullName: ' + this.name); | |
} | |
//This time it will print the fullname | |
student.sayFullName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment