## Console.log
Console.log is a method in JavaScript used to print messages to the browser's console. It's often used for debugging and displaying information during development.
## var
The `var` keyword is used to declare variables in JavaScript. Variables are containers for storing data values.
## Basics of JavaScript
JavaScript is a programming language that enables interactive web pages. It's commonly used for adding dynamic behavior to websites.
## Style
The `<style>` tag in the head section allows you to define CSS styles for your HTML document. It helps in controlling the presentation and layout.
## Div
The `<div>` element is a container that groups other HTML elements. It's often used to structure and style content on a webpage.
## Class
The `class` attribute is used to apply one or more CSS classes to an HTML element. It's a way to style multiple elements with the same style rules.
## onclick
The `onclick` attribute is an event handler in HTML that executes a specified JavaScript function when a user clicks on an element.
## target
The `target` attribute in an anchor (`<a>`) tag specifies where to open the linked document. `_blank` opens the link in a new window or tab.
## href
The `href` attribute in an anchor (`<a>`) tag specifies the URL of the linked document.
## Function
A function is a reusable block of code that performs a specific task. In JavaScript, you can define and call functions.
## div1 and div2
These are classes applied to `<div>` elements, each with its own set of CSS styles. They define the appearance of the div elements.
## toggleVisibility()
`toggleVisibility` is a JavaScript function that toggles the visibility of an HTML element based on its current state.
## %%html in Jupyter Notebook
In Jupyter Notebook, `%%html` is a magic command that allows you to include HTML code directly in a cell. It's used to render HTML content within the notebook.
## %%js in Jupyter Notebook
Similarly, `%%js` is a magic command in Jupyter Notebook for including JavaScript code directly in a cell. It enables the execution of JavaScript within the notebook environment.
Console Logging:
The script uses console.log() to print the entire object (person) to the browser console, providing a snapshot of its initial state. Array Manipulation:
Arrays within the object (currentClasses and interests) are manipulated using push() and splice() methods. A class (“Spanish 7”) is added to the currentClasses array. The third element of the interests array is replaced with “History 3.” Console Logging After Manipulation:
Another console.log() statement is used to print the entire object (person) to the console after the manipulation of arrays. Mathematical Operations:
Mathematical operations are performed on fields in the object. The age of the person in five years is calculated (ageInFiveYears). The number of current classes is determined (numberOfClasses). Console Logging of Results:
console.log() statements are used to print the results of the mathematical operations with contextual information. Typeof Operator:
The typeof operator is used to determine the types of certain fields within the person object. Types of fields such as name, interests, and age are determined and printed to the console. Console Logging Types of Fields: