These are about JS codes.   Q1: Make a new object called "person". Give the person object 2 properties;  * name  * age  name should be a string array, the first position holds your first name, and second your last.  age should be a number, date    * output the entire object to the console.   /*******************************************************************************   * Information:   *    * DOT NOTATION   *    * The object name (person) acts as the namespace — it must be entered first to access    * anything inside the object. Next you write a dot, then the item you want to access    * — this can be the name of a simple property, an item of an array property, or a call   *  to one of the object's methods.   *    * If you defined your object correctly in Q1, the following code should display your    * name and age   * ex:   ********************************************************************************/    console.log(person.name);    console.log(person.age);

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

These are about JS codes.

 

Q1:
Make a new object called "person". Give the person object 2 properties;
 * name
 * age
 name should be a string array, the first position holds your first name, and second your last.
 age should be a number, date
 
 * output the entire object to the console.

  /*******************************************************************************
  * Information:
  * 
  * DOT NOTATION
  * 
  * The object name (person) acts as the namespace — it must be entered first to access 
  * anything inside the object. Next you write a dot, then the item you want to access 
  * — this can be the name of a simple property, an item of an array property, or a call
  *  to one of the object's methods.
  * 
  * If you defined your object correctly in Q1, the following code should display your 
  * name and age
  * ex:
  ********************************************************************************/
   console.log(person.name);
   console.log(person.age);


 Q2:
 Redfine (recreate) your person object to include a function. 
 The function should be called "bio" and should output your first name, 
 last name and age to the console when you call it.
 
 * Make sure to use DOT notation for your output.
 
 * ex:
 * Harry Scanlan is 35 years old
 * 
 * Use your function to display the output to the screen.
 * 
 */


  Q3:
  Using the same Object from Q2, ADD a new property to your object.
  This property should be called "studentid" and should be defaulted to your student number.
  
  * DO NOT redefine your object. You must ADD the property to it.
  
  * You may have to research "how to add a new property to a javascript object"
  
  * Make sure to use DOT notation for your input/output.
  
  * Display the entire object using the console.
  
   
   Q4:
  Using the same object from Q2, ADD a new function called "introduceSelf()"
  DO NOT redefine your object. You must ADD the property to it.
  The function should introduce yourself by just your first name and your student id.
 Call your function to display your output.
  
  * Ex:
  * Hi! I'm Harry and my student id is 1234567.
  */

  
  
  /*******************************************************************************
  * Information:
  * An object like this is referred to as an object literal — we've literally written 
  * out the object contents as we've come to create it. This is different compared to 
  * objects instantiated from classes, which we'll look at later on.
  ********************************************************************************/
  
  
  Q5:
  So far we've been using DOT notation, but we can also use Bracket Notation when accessing objects. 
 
  Display your FIRST NAME only and age using Bracket notation in the console.

 

  Q6:
  Add another function to your person object that outputs the same as bio(), but uses BRACKET notation for the output instead of DOT notation. 
 
 Call the function bioBracket() and then use it to display your output.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage