Week 4 - Functions, Objects, and Event Listeners

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/21

flashcard set

Earn XP

Description and Tags

Flashcards on JavaScript functions, objects, DOM, and event handlers.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

22 Terms

1
New cards

Functions

Reusable blocks of code that perform specific tasks, helping to organize code and make it more maintainable.

2
New cards

Function Name

A unique identifier given to a function by the developer.

3
New cards

Parameters/Arguments

Values passed into a function to provide input.

4
New cards

Function Body

The block of statements within a function that gets executed.

5
New cards

Object

An entity with properties, consisting of key-value pairs representing related data in an unordered fashion.

6
New cards

How to Create Function?

using either a function declaration or a function expression.

7
New cards

Function Declaration

Can be used to create objects. It is defined by using the ‘function’ keyword followed by the function name.

8
New cards

Function Expression

Created by assigning a function to a variable and not hoisted, requiring definition before calling. Can be used to create objects but must be defined before they are used.

9
New cards

DOM (Document Object Model)

Represents a web page as a tree structure and allows programs to interact with and manipulate the document’s structure, style, and content.

10
New cards

Events

Actions or occurrences that happen in the browser, triggered by user interactions or the browser itself.

11
New cards

Event Handler

Allow you to respond to specific events that occur in the browser, attached to HTML elements using event attributes or addEventListener() method.

12
New cards

addEventListener()

JavaScript method that attaches event handlers to HTML elements. The syntax is document.addEventListener(event, function).

13
New cards

onchange

Fired when an HTML element has been changed, useful for handling user input changes.

14
New cards

onclick

Triggered when the user clicks an HTML element, commonly used for button clicks and other interactive elements.

15
New cards

onmouseover

Fired when the user moves the mouse pointer over an HTML element, useful for creating hover effects.

16
New cards

onmouseout

Triggered when the user moves the mouse away from an HTML element, often used to revert styles after a hover effect.

17
New cards

onkeydown

Occurs when the user pushes a keyboard key, useful for capturing keyboard input.

18
New cards

onload

Fired when the browser has finished loading the page, useful for initializing scripts or fetching data.

19
New cards

onsubmit

Triggered when a form is submitted, allows validation and form handling.

20
New cards

onfocus

Occurs when an element receives focus, useful for enhancing accessibility.

21
New cards

onblur

Fired when an element loses focus, often used for form validation.

22
New cards

onresize

Triggered when the browser window is resized, useful for responsive design adjustments.