Question

Write in Javascript, create a Javascript "Todo" object with the following properties. And declare the two...

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

  • name
  • description
  • datetime
  • useremail

functions

  • getName()
  • getUserEmail()

Homework Answers

Answer #1

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>

 

 
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create a Survey Object with 3 Properties. Name, Description, Question array Create a form that can...
Create a Survey Object with 3 Properties. Name, Description, Question array Create a form that can populate those properties for the survey and use the question form to create 3 questions. Create the Survey object with functions as well. You will need to populate this object with the above properties like a copy constructor. Concepts to use are JSON, and local storage.
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a...
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a new string from a given string changing the position of first and last characters. The string length must be greater than or equal to 1. 2)Write a JavaScript program to check whether a string starts with 'Java' and false otherwise
Please linked both files. For this assignment you need to create a ToDo list using Javascript,...
Please linked both files. For this assignment you need to create a ToDo list using Javascript, along with HTML and CSS. Begin by creating a HTML page called todo.html. Then create a Javascript file called todo.js and link it in to the HTML page using a script tag. All Javascript for the assignment must be in the separate file. (For CSS, feel free to include styles in a style block at the top of the HTML page, or to link...
Write the program in java Implement a class Product. Create instance variables to store product name...
Write the program in java Implement a class Product. Create instance variables to store product name and price and supply the values through constructor. For example new Product(“Toaster’, 29.95). Create methods, getName, getPrice. Write a method productPrinter that prints the product name and its price after reducing it by $5. Create a main class and necessary constructs in the main class to run the Product class.
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in...
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in milliseconds. Delay should return a function that, when invoked waits for the specified amount of time before executing. HINT - research setTimeout(); 2.Create a function saveOutput that accepts a function (that will accept one argument), and a string (that will act as a password). saveOutput will then return a function that behaves exactly like the passed-in function, except for when the password string is...
Create a new project in BlueJ. Create two new classes in the project, with the following...
Create a new project in BlueJ. Create two new classes in the project, with the following specifications: Class name: Runner Fields: bibId (int) event (String) age (int) 1 Constructor: takes parameters runnerBibId, raceEvent, and runnerRaceDayAge as parameters to initialize fields Methods: Write get-methods (getters) for all three fields. The getters should be named getBibId, getEvent, and getAge. Save the project as a jar file to submit.
Please use javascript. Square Class Create a square class defined by the following Property side Methods...
Please use javascript. Square Class Create a square class defined by the following Property side Methods perimeter (side times 4) area (side squared) diagonal (square root of 2 * side squared) describe – shows the squares information as follows: Square with side 2 has perimeter of 8, area of 4, and diagonal of 2.828 Your program is to create three squares and use the describe method to show each squares information.
Write the following problem in Java Create a class Dog, add name, breed, age, color as...
Write the following problem in Java Create a class Dog, add name, breed, age, color as the attributes. You need to choose the right types for those attributes. Create a constructor that requires no arguments. In this constructor, initialize name, breed, age, and color as you wish. Define a getter and a setter for each attribute. Define a method toString to return a String type, the returned string should have this information: “Hi, my name is Lucky. I am a...
defined by the following UML, write a tostring method that displays a Dog object in the...
defined by the following UML, write a tostring method that displays a Dog object in the following from dog with name Fido (assuming name field contains Fido). Given the Dog class defined by the following UML, write a tostring method that displays a Dog object in the following from dog with name Fido (assuming name field contains Fido). dog -name:string +Dog(string) +bark(void):void
Python. create a function that takes a string as a parameter and prints out the following...
Python. create a function that takes a string as a parameter and prints out the following details as the example output below. If the string is "Hello, my name is Starling, Clarice. My, my, my, nice to meet you." The output would be: Unique words: 10 Number of commas: 5 Number of periods: 2 Number of sentences: 2 (HINT: Use the following string methods: split, lower, count, replace, format, and use the following functions: set, len. You may need to...