Basic Developer Questions

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

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards

What is JavaScript and how is it different from HTML and CSS?

JavaScript is a high-level, dynamic programming language primarily used for creating interactive effects within web browsers. Unlike HTML, which structures content, and CSS, which styles it, JavaScript adds functionality and interactivity to web pages.

Or

JavaScript is a programming language that allows you to create interactive and dynamic content on web pages, while HTML structures the content and CSS styles it.

2
New cards

What are the primary data types in JavaScript?

The primary data types in JavaScript include Undefined, Null, Boolean, Number, String, BigInt, and Symbol. These types determine the kind of values that can be stored and manipulated in a program.

Or

The primary data types are undefined, null, boolean, number, string, symbol (since ES6), and object.

3
New cards

What is a variable, and how do you declare one?

A variable is a named storage location in a program that holds data which can be changed during execution. In JavaScript, you can declare a variable using the keywords var, let, or const.

OR

A variable is a named container for storing data values. You can declare one using var, let, or const. For example: let name = "John";.

4
New cards

What are local and global variables?

Local variables are defined within a function and are only accessible within that function, while global variables are declared outside any function and can be accessed from anywhere in the code.

OR

Local variables are declared within a function and can only be accessed there, while global variables are declared outside any function and can be accessed from anywhere in the script.

5
New cards

What is a JavaScript function and how do you declare one?

A JavaScript function is a block of code designed to perform a particular task, which can be executed when called. You can declare a function using the function keyword followed by a name and parentheses.

OR

A function is a reusable block of code that performs a specific task. You can declare one using the function keyword, like this: function greet() { console.log("Hello"); }.

6
New cards

How do you create an object in JavaScript?

You can create an object in JavaScript using object literals, the Object constructor, or the class syntax. An object literal is defined using curly braces with key-value pairs.

OR

An object can be created using object literals or constructors. For example: let person = { name: "John", age: 30 };.

7
New cards

What is the purpose of the "this" keyword?

The "this" keyword in JavaScript refers to the context in which a function is executed, allowing access to the object that is currently invoking the function. It can vary depending on how the function is called.

OR

The "this" keyword refers to the context in which a function is called. In a method, it refers to the object that owns the method.

8
New cards

How does scope work in JavaScript?

Scope in JavaScript refers to the accessibility of variables and functions in different parts of your code. It defines where variables can be accessed and modified, typically categorized into global and local scope.

OR

Scope refers to the visibility of variables and functions. JavaScript has function scope and block scope (for variables declared with let or const).

9
New cards

What are closures and how are they useful?

Closures are functions that retain access to their outer scope even after the outer function has finished executing. They are useful for data encapsulation and creating private variables.

OR

A closure is a function that retains access to its lexical scope, even when executed outside that scope, which allows for data encapsulation and private variables.

10
New cards

What is event bubbling and capturing?

Event bubbling and capturing are two phases of event propagation in the DOM. Bubbling occurs when an event starts from the target element and bubbles up to the root, while capturing starts from the root and goes down to the target.

OR

Event bubbling is when an event starts from the target element and bubbles up to the root, while capturing is the opposite, where the event starts from the root and goes down to the target.

11
New cards

How can you manipulate the DOM using JavaScript?

You can manipulate the DOM using JavaScript by selecting elements, modifying their attributes, adding or removing elements, and responding to events, allowing dynamic updates to the webpage.

OR

You can manipulate the DOM using methods like document.getElementById(), element.appendChild(), and element.style.

12
New cards

What is a promise and how does it work?

A promise is an object that represents the eventual completion or failure of an asynchronous operation and its resulting value. It allows you to write cleaner and more manageable asynchronous code by using methods like .then() and .catch() to handle results and errors.

OR

A promise is an object representing the eventual completion (or failure) of an asynchronous operation, allowing you to handle asynchronous actions more effectively.

13
New cards

How do you handle asynchronous operations in JavaScript?

You handle asynchronous operations in JavaScript using promises, which represent a value that may be available now, or in the future, or never. Promises allow you to attach callbacks for when the operation completes or fails.

OR

You can handle asynchronous operations using callbacks, promises, or the async/await syntax for cleaner, more readable code.

14
New cards

What is the difference between "==", "===", and "!="?

" checks for value equality with type coercion, "=" checks for both value and type equality, and "!=" checks for value inequality with type coercion.

OR

== checks for equality with type coercion, === checks for strict equality without coercion, and != checks for inequality with coercion.

15
New cards

What are arrow functions, and how do they differ from regular functions?

Arrow functions are a concise way to write function expressions in JavaScript, characterized by their use of the => syntax. They differ from regular functions in that they do not have their own this, making them particularly useful for preserving the context of this in callbacks.

OR

Arrow functions provide a shorter syntax for functions and do not have their own this context, inheriting it from the outer function.

16
New cards

What is a callback function?

A callback function is a function that is passed as an argument to another function and is executed after a certain event or operation has completed, allowing for asynchronous programming.

OR

A callback function is a function passed as an argument to another function, to be called when an event occurs or a task is completed.

17
New cards

How can you prevent default behavior in an event?

You can prevent default behavior in an event by using the preventDefault() method on the event object within an event handler.

OR

You can prevent default behavior using event.preventDefault() within an event listener.

18
New cards

What are template literals and how do you use them?

Template literals are string literals allowing embedded expressions, defined by backticks (`). They enable multi-line strings and string interpolation using ${expression}.

OR

Template literals are string literals allowing embedded expressions, enclosed by backticks (). Example: let message = Hello, ${name};``.

19
New cards

What is the difference between let, const, and var?

The difference between let, const, and var lies in their scope, hoisting behavior, and mutability. 'let' and 'const' are block-scoped, while 'var' is function-scoped; 'const' cannot be reassigned, whereas 'let' and 'var' can be.

OR

var declares a function-scoped variable, let declares a block-scoped variable, and const declares a block-scoped variable that cannot be reassigned.

20
New cards

What is JSON and how do you work with it in JavaScript?

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. In JavaScript, you can work with JSON using the JSON object, which provides methods like JSON.stringify() to convert objects to JSON strings and JSON.parse() to convert JSON strings back into JavaScript objects.

OR

JSON (JavaScript Object Notation) is a lightweight data interchange format. You can parse it using JSON.parse() and stringify JavaScript objects using JSON.stringify().

21
New cards

How do you handle errors in JavaScript?

Error handling in JavaScript is typically done using try, catch, and finally blocks. The try block contains code that may throw an error, the catch block handles the error, and the finally block executes code after the try/catch, regardless of the outcome.

OR

You can handle errors using try...catch statements to catch exceptions that may occur during code execution.

22
New cards

What are JavaScript modules, and how do you export/import them?

JavaScript modules are reusable pieces of code that can be exported from one file and imported into another. They help to organize and encapsulate code, allowing for better maintainability and avoiding global namespace pollution.

OR

JavaScript modules allow for code organization and reuse. You can export functions or variables using export and import them using import.

23
New cards

What is the purpose of the 'debugger' statement?

The 'debugger' statement in JavaScript is used to pause the execution of code and invoke the debugging functionality of the browser's developer tools. It allows developers to inspect the state of the application at that point in the code.

OR

The debugger statement is a debugging tool that pauses code execution, allowing you to inspect variables and execution flow in the browser's developer tools.

24
New cards

How can you optimize performance in JavaScript applications?

Optimizing performance in JavaScript applications involves various techniques such as minimizing DOM manipulation, using asynchronous programming, optimizing loops, and reducing the size of scripts. Additionally, leveraging caching and using performance profiling tools can help identify bottlenecks.

OR

You can optimize performance by minimizing DOM access, using efficient algorithms, reducing memory consumption, and employing lazy loading techniques.

25
New cards

What is the use of the window object in the browser?

The window object represents the browser's window and serves as the global object in a web page. It provides methods and properties to control the browser, access the DOM, and manage events.

OR

The window object represents the browser window and provides properties and methods for accessing the browser's features, such as window.alert() and window.location.