Write in Javascript, create a Javascript "Todo" object with the following properties. And declare the two functions/methods below as prototype functions for the object.
Todo
functions
var TODO = {
name: 'John',
description: 'Hello world',
datetime: new Date(),
useremail:'[email protected]'
}
function getUserEmail(){
return TODO.useremail;
}
function getName(){
return TODO.name;
}
Full code
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Objects</h2>
<p id="demo"></p>
<script>
var TODO = {
name: 'John',
description: 'Hello world',
datetime: new Date(),
useremail:'[email protected]'
}
function getUserEmail(){
return TODO.useremail;
}
function getName(){
return TODO.name;
}
document.getElementById("demo").innerHTML = getName();
document.getElementById("demo").innerHTML += getUserEmail();
</script>
</body>
</html>
Get Answers For Free
Most questions answered within 1 hours.