LESSON2-JAVASCRIPT Flashcards

1
Q

offer simplicity and flexibility, making them suitable for a wide range of applications, from basic contact forms to complex data entry interfaces.

A

HTML Forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

HTML provides a robust set of form elements, including input fields, buttons, checkboxes, radio buttons, dropdown menus, and text areas

A

HTML Forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

is essential for ensuring that user input meets specified criteria before submitting data to a server.

A

Form Validation Using JavaScript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

display error messages or highlight invalid fields to guide users

A

Clear Feedback

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

define validation rules for each form field, such as required fields or email formats

A

Custom Rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

use JavaScript event handlers to trigger validation as users interact with fields

A

Event Handling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Test validation across browsers to ensure consistent behavior.

A

Cross-Browser Compatibility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

utilize regex for precise validation, like checking emails or phone formats

A

Regular Expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Implement ___________- as a fallback for security.

A

Server-Side Validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Optimize validation logic for efficient processing, especially in complex forms.

A

Performance Optimization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Ensure error messages are accessible to all users.

A

Accessibility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

improves usability, data integrity, and user satisfaction in web applications.

A

JavaScript Form Validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  • involves executing code within the user’s web browser. This code is downloaded along with the web page and runs on the client’s device.
A

Client-Side Scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  • The primary languages used for client-side scripting are ?, ? ,?.
A

HTML
CSS
JavaScript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Advantages of Client-Side Scripting

A

Improved User Experience
Reduced Server Load
Instant Feedback

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Client-side scripting enables interactive and dynamic web pages, enhancing ________ through features like form validation, animations, and real-time updates.

A

Improved User Experience

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

By offloading processing tasks to the client’s device, client-side scripting helps distribute the workload, reducing the burden on the server and improving overall system performance.

A

Reduced Server Load

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

With client-side scripting, users receive immediate feedback without waiting for server responses, leading to faster interactions and smoother browsing experiences.

A

Instant Feedback

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Common Use Cases of Client-side Scripting

A
  1. Form Validation
  2. Dynamic Content Generation
  3. User interface and user experience enhancements (e.g., dropdown menus, sliders)
  4. Client-side storage (e.g., cookies, local storage)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
  • involves executing code on the web server before delivering the resulting web page to the client’s browser.
A

Server-Side Scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q
  • Common server-side scripting languages include ?, ?, ?, ?.
A

PHP
Python
Ruby
Node.js.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Advantages of Server-Side Scripting

A

Enhanced Security
Access to Server Resources
Platform Independence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Server-side scripting allows sensitive operations and data processing to be performed on the server, reducing the risk of exposing critical code or data to users.

A

Enhanced Security

24
Q

Server-side scripting enables access to server resources like databases, file systems, and external APIs, facilitating complex operations and data manipulation.

A

Access to Server Resources

25
Q

Server-side scripts run independently of the client’s device and browser, ensuring consistent behavior and compatibility across different platforms.

A

Platform Independence

26
Q

Common Use Cases of Server-side Scripting

A
  1. User authentication and authorization
  2. Database operations (e.g., CRUD operations)
  3. Content Management Systems (e.g., WordPress)
27
Q

In HTML, JavaScript code is inserted between ________ tags either within the head and/or body sections of an HTML document.

A
<script>

</script>
28
Q

One of the many JavaScript HTML methods is ________. This method finds an HTML element and changes the element’s content

A

getElementById()

29
Q
  • ______ are containers used to store data values in JavaScript
  • They are declared using the var, let, or const keywords.
  • _______ can hold various types of data, including numbers, strings, arrays, objects, and functions.
A

Variables

30
Q

JavaScript can “display” data in different ways:

A

innerHTML
document.write()
window.alert()
console.log()

31
Q
  • ________ are similar to variables but their values cannot be changed once assigned.
  • They are declared using the const keyword.
  • ______ are useful for defining values that should remain constant throughout the program.
  • ________cannot be redeclared nor reassigned, and they have block scope.
A

Constants

32
Q

Use constants to declare the following:

A

a. A new array
b. A new object
c. A new function

33
Q
  • _________ allow developers to execute different blocks of code based on specified conditions.
  • In JavaScript, the if, else if, and else statements are commonly used for conditional execution.
  • Additionally, the switch statement provides an alternative for handling multiple conditions.
A

Conditional Statements

34
Q
  • ________ are used to assign values to variables.
  • In JavaScript, the assignment operator “=” is used to assign values.
  • Additionally, compound assignment operators like +=, -= can be used for shorthand assignment.
A

Assignment Statements

35
Q
  • Loops are used to execute a block of code repeatedly as long as a specified condition is true.
  • JavaScript provides several types of loops, including for, while, and do-while loops.
  • These loops offer flexibility in controlling the iteration process
A

Loop Statements

36
Q

Inside the function, the _____ behave as local variables

A

Parameters

37
Q
  • is a programming paradigm that emphasizes the use of functions as the primary building blocks of software.
  • In JavaScript, functions are first-class citizens, meaning they can be assigned to variables, passed as arguments to other functions, and returned from functions, making it well-suited for ____________
A

Functional programming

38
Q
  • Functions that have access to variables from their outer scope; a function bundled with its lexical environment
  • allow a function to access variables from an outer function that has already returned, even though its scope is “closed” over the local variables it defines.
A

Closures

39
Q
  • Think of ______ in functional programming as encapsulation in OOP, giving us a degree of data
    privacy
  • ______ can also be used to create function factories, where a function generates and returns another function with specific characteristics.
A

Closures

40
Q
  • Functional programming encourages ________, where data is kept immutable and changes are made by creating new copies rather than modifying
  • This reduces the risk of unintended side effects and simplifies debugging.
  • In JavaScript, ______ can be achieved using methods like Object.assign(), spread syntax (…), or libraries like Immutable.js.
A

Immutability

41
Q
  • __________ are functions that either take other functions as arguments or return functions as results.
  • They enable abstraction and code reuse by allowing common patterns to be encapsulated into reusable functions.
  • Examples of _________ in JavaScript include map(), filter(), and reduce(), which operate on arrays and accept functions as arguments.
A

Higher-order functions

42
Q
  • ______ are actions or occurrences that happen in the browser, such as mouse clicks, keyboard inputs, form submissions, and page loading.
A

Events

43
Q
  • ______ are triggered by user interactions or changes in the browser environment and can be captured and handled by JavaScript code.
A

DOM events

44
Q
  • a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.
A

DOM (Document Object Model)

45
Q
  • are functions that are executed in response to specific events.
A

Event handlers

46
Q
  • In JavaScript, _______ can be attached to DOM elements using various methods, such as the addEventListener() method or by assigning event handler properties directly to DOM elements.
A

Event Handlers

47
Q
  • is a function in JavaScript that waits for an event to occur then responds to it.
A

Event Listener

48
Q

Common Events

A

onchange
onclick
onmouseover
onmouseout
onkeydown
onload

49
Q
  • determines in which order the elements receive the event. There are two ways to handle this _______ order of HTML DOM is Event Bubbling and Event Capturing
A

Event Propagation

50
Q
  • When an event happens on a component, it first runs the event handler on it, then on its parent component, and then up on other ancestors’ components. By default, all event handles through this order from the center component event to the
    outermost component event.
A

Event Bubbling

51
Q
  • It is the opposite of bubbling. The event handler is first on its parent component and then on the component where it wants to fire that event handler. In short, it means that the event is first captured by the outermost element and propagated to the inner elements. It is also called trickle down.
A

Event Capturing

52
Q

Event Capturing also called?

A

Trickle Down

53
Q
  • When an event occurs, an _______ containing information about the event is created and passed to the event handler function. The ______ provides properties and methods that allow developers to access details such as the event type, target element, mouse coordinates, and keyboard key codes.
A

Event Object

54
Q

is a technique used to handle events on multiple elements efficiently, particularly when dealing with dynamically generated or large sets of elements.

A

Event Delegation

55
Q
  • Instead of attaching event handlers to individual elements, _____ involves attaching a single event handler to a common ancestor element and using event bubbling to capture events from its descendants.
A

Event Delegation