JavaScript Fundamentals

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/46

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

47 Terms

1
New cards
How can you refresh a web page using JavaScript?
By using the location.reload method.
2
New cards
What is the purpose of using external JavaScript files?
To reuse identical JavaScript code across multiple pages without duplication.
3
New cards

How do you include an external JavaScript file in HTML?

Using the <script> tag with the src attribute pointing to the .js file.

4
New cards
What is the role of comments in JavaScript?
Comments are used to explain code and are not executed by the JavaScript engine.
5
New cards
What is the syntax for writing a simple JavaScript function?
function functionName() { // code to execute }
6
New cards
What is the purpose of using semicolons in JavaScript?
To terminate statements and improve code readability.
7
New cards
What is the effect of JavaScript on user experience?
It enhances interactivity and provides immediate feedback, improving overall user engagement.
8
New cards
What are drag-and-drop components in JavaScript?
Interactive elements that allow users to move items within the interface.
9
New cards
How does JavaScript contribute to richer interfaces?
By enabling dynamic content and interactive features like sliders and animations.
10
New cards
What is the function of an alert dialog box?
An alert dialog box is used to display a warning message to users, typically with an 'OK' button.
11
New cards
What does a confirmation dialog box do?
It asks for the user's consent with 'OK' and 'Cancel' buttons, returning true or false based on the user's choice.
12
New cards
What is the purpose of a prompt dialog box?
It displays a text box for user input, returning the entered value or null if canceled.
13
New cards
What are the three primitive data types in JavaScript?
Numbers, strings, and booleans.
14
New cards
What are the two trivial data types in JavaScript?
null and undefined.
15
New cards
What is the significance of the var keyword in JavaScript?
It is used to declare variables.
16
New cards
What is a global variable in JavaScript?
A variable that can be defined anywhere in the code and is accessible throughout the program.
17
New cards
What is a local variable in JavaScript?
A variable that is only visible within the function where it is defined.
18
New cards
What types of operators does JavaScript support?
Arithmetic, comparison, logical, assignment, and conditional operators.
19
New cards
What are arithmetic operators in JavaScript?
Operators that perform mathematical calculations, such as +, -, *, and /.
20
New cards
What are comparison operators in JavaScript?
Operators that compare two values and return a boolean result, such as ==, ===, >, and
21
New cards
What are logical operators in JavaScript?
Operators that combine boolean values, such as && (AND), || (OR), and ! (NOT).
22
New cards
What does the typeof operator do in JavaScript?
It returns a string indicating the data type of its operand.
23
New cards
What is the conditional operator in JavaScript?
A ternary operator that evaluates a condition and executes one of two statements based on the result.
24
New cards
What is a limitation of client-side JavaScript?
It cannot read or write files for security reasons.
25
New cards
Why can't JavaScript be used for networking applications?
There is no support available for networking in JavaScript.
26
New cards
What is case sensitivity in JavaScript?
JavaScript distinguishes between uppercase and lowercase letters in variable names and function names.
27
New cards
How can you enable JavaScript in Internet Explorer?
Select the Disable radio button under Active scripting in the settings.
28
New cards
What steps are required to enable JavaScript in Firefox?
Type about:config in the address bar, accept the warning, search for JavaScript, and toggle the Enabled option.
29
New cards
What is an event in JavaScript?
An event is an interaction with the HTML page, such as loading the page or clicking a button.
30
New cards
What is the significance of JavaScript's lightweight nature?
It allows for quick execution and less resource consumption in web applications.
31
New cards
What is the importance of validating user input with JavaScript?
It reduces server load and provides immediate feedback to users.
32
New cards
What is the purpose of the setTimeout() function in JavaScript?
setTimeout() is used to execute a function after a specified time interval.
33
New cards
What are the three types of dialog boxes supported by JavaScript?
Alert dialog box, confirmation dialog box, and prompt dialog box.
34
New cards
What does variable initialization mean in JavaScript?
It refers to assigning a value to a variable at the time of declaration or later.
35
New cards
What are the two scopes of variables in JavaScript?
Global scope and local scope.
36
New cards
What rules should be followed when naming variables in JavaScript?
Variable names cannot use reserved keywords, must not start with a numeral, and are case-sensitive.
37
New cards
What is an operator in JavaScript?
An operator is a symbol that performs operations on operands, such as addition or comparison.
38
New cards
What is JavaScript?
A lightweight, interpreted programming language used to create interactivity in web pages.
39
New cards
What are the advantages of using JavaScript?
Less server interaction, immediate feedback to users, increased interactivity, and richer interfaces.
40
New cards
What is the significance of whitespace and line breaks in JavaScript?
They are good programming practices, and semicolons should be used to terminate statements.
41
New cards
How do you enable JavaScript in Chrome?
Go to Settings, click Show advanced settings, and adjust the Content settings under the Privacy section.
42
New cards
What is the preferred placement of JavaScript in an HTML document?
JavaScript can be placed in the or sections, or in an external file linked in the .
43
New cards
What is the onclick event type?
It occurs when a user clicks the left mouse button.
44
New cards
What does the onsubmit event type do?
It triggers when a form is submitted, allowing for form validation.
45
New cards
What are the onmouseover and onmouseout events?
onmouseover triggers when the mouse hovers over an element, while onmouseout triggers when the mouse leaves the element.
46
New cards
What is page redirection in JavaScript?
It is when a user is directed from one URL to another, different from a page refresh.
47
New cards
What is the difference between window.location.href and location.replace?
window.location.href adds the current page to history, while location.replace does not.