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);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education