Modern JavaScript Flashcards

1
Q

What was the ‘old-school’ way of adding JavaScript libraries to a website?

A

Manually downloading library files and linking them with script tags in the HTML.

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

What problem did JavaScript package managers solve?

A

They automated the process of downloading and upgrading libraries from a central repository.

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

Which package manager eventually became the standard for frontend JavaScript around 2015?

A

npm (Node Package Manager)

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

What is the purpose of package.json?

A

It’s a configuration file that npm uses to save project information, including dependencies.

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

What command creates a new package.json file?

A

npm init

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

What is the significance of the node_modules folder?

A

It contains all the code from installed packages (dependencies).

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

Why was JavaScript originally designed without a module system?

A

JavaScript was initially designed to only run in the browser with no access to the client’s file system.

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

What is a JavaScript module bundler?

A

A tool that finds all module dependencies during a build step and combines them into browser-compatible output files.

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

What was the first popular module bundler mentioned in the article?

A

Browserify (released in 2011)

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

Which module bundler eventually became more widely used around 2015?

A

webpack

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

What does the ‘require()’ function do in Node.js?

A

It imports code from another module or file.

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

What is the ES2015 (ES6) alternative to ‘require()’?

A

The import statement

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

What file is typically used to configure webpack?

A

webpack.config.js

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

What does ‘transpiling’ mean in the context of JavaScript?

A

Converting code from one language to code in a similar language (e.g., modern JavaScript to older, more compatible JavaScript)

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

What is Babel used for?

A

Transpiling next-generation JavaScript features to older, more browser-compatible JavaScript.

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

What was CoffeeScript?

A

An early JavaScript transpiler/language that focused on improving JavaScript by changing the syntax significantly.

17
Q

What is TypeScript?

A

A language similar to next-generation JavaScript that adds optional static typing.

18
Q

What is babel-loader?

A

A package that enables Babel to work with webpack.

19
Q

What is a task runner in frontend development?

A

A tool that automates different parts of the build process (minifying code, optimizing images, running tests, etc.)

20
Q

What were the two popular task runners mentioned from around 2013?

A

Grunt and Gulp

21
Q

What is the modern alternative to dedicated task runners mentioned in the article?

A

npm scripts (using the scripting capabilities built into the npm package manager)

22
Q

What does the ‘–watch’ option do in webpack?

A

It automatically re-runs webpack each time any JavaScript file changes.

23
Q

What is webpack-dev-server?

A

A development server that provides a simple web server with live reloading capabilities.

24
Q

What framework-specific CLI tools were mentioned that help simplify JavaScript tooling?

A

ember-cli, angular-cli, create-react-app, and vue-cli.

25
Q

What is an example of an ES2015 feature mentioned in the article?

A

Template strings (using backticks with ${variable} syntax)

26
Q

What is the ‘–mode=production’ option in webpack used for?

A

Minifying code for production