Home HTML Data Types DOM JavaScript JS Debugging

Hacks

Create a JavaScript snippet below with the following requirements:

  • Create an object representing yourself as a person. The object should have keys for your name, age, current classes, interests, and two more of your choosing
  • Your object must contain keys whose values are arrays. The arrays can be arrays of strings, numbers, or even other objects if you would like
  • Print the entire object with console.log after declaring it
  • Manipulate the arrays within the object and print the entire object with console.log as well as the specific changed key afterwards
  • Perform mathematical operations on fields in your object such as +, -, /, % etc. and print the results with console.log along with a message contextualizing them
  • Use typeof to determine the types of at least 3 fields in your object

Object representing me with some manipulated array values

Numerical operations

typeOf function