mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): remove video from JavaScript Fundamentals Review lectures (#61617)
This commit is contained in:
+3
-10
@@ -1,22 +1,15 @@
|
||||
---
|
||||
id: 6732c6ab21031b60d2b0c999
|
||||
title: What Are Some Common Practices for Naming Variables and Functions?
|
||||
challengeType: 11
|
||||
videoId: wheRZCpE724
|
||||
challengeType: 19
|
||||
dashedName: what-are-some-common-practices-for-naming-variables-and-functions
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What are some common practices for naming variables and functions?
|
||||
|
||||
Naming variables and functions is an important aspect of writing clean, readable and maintainable code. Good naming practices makes your code self-documenting reducing the need for extensive comments and making it easier for other developers including your future self to understand your code.
|
||||
|
||||
Let's start with general naming conventions in JavaScript. In previous lecture videos you learned about using camel case for variable names. For boolean variables, it's a common practice to use prefixes such as `is`, `has`, or `can`. This immediately tells the reader that the variable is a boolean:
|
||||
Let's start with general naming conventions in JavaScript. In previous lectures you learned about using camel case for variable names. For boolean variables, it's a common practice to use prefixes such as `is`, `has`, or `can`. This immediately tells the reader that the variable is a boolean:
|
||||
|
||||
```js
|
||||
let isLoading = true;
|
||||
@@ -92,7 +85,7 @@ function keyPressHandler(){
|
||||
}
|
||||
```
|
||||
|
||||
An event handler is an action that happens after an event has happened like a button click. You will learn about that in future lecture videos.
|
||||
An event handler is an action that happens after an event has happened like a button click. You will learn about that in future lectures.
|
||||
|
||||
When naming iterator variables and loops, it's common to use single letters like `i`, `j`, or `k`, but for nested loops or more complex iterations more descriptive names can be helpful:
|
||||
|
||||
|
||||
+2
-9
@@ -1,20 +1,13 @@
|
||||
---
|
||||
id: 6732c6ba2ea42b610b9f9ce1
|
||||
title: How Do You Get the Length for an Array, and How Can You Create an Empty Array of Fixed Length?
|
||||
challengeType: 11
|
||||
videoId: ezk1SIbBDqw
|
||||
challengeType: 19
|
||||
dashedName: how-do-you-get-the-length-for-an-array-and-how-can-you-create-an-empty-array-of-fixed-length
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
How do you get the length for an array, and how can you create an empty array of fixed length?
|
||||
|
||||
In prior lecture videos you were first introduced to the `length` property, this property returns the number of elements in an array. So here is a quick reminder on how it works:
|
||||
In prior lectures you were first introduced to the `length` property, this property returns the number of elements in an array. So here is a quick reminder on how it works:
|
||||
|
||||
```js
|
||||
const fruits = ['apple', 'banana', 'orange'];
|
||||
|
||||
+1
-8
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 6732c6c72d3738614e1230a2
|
||||
title: What Are Linters and Formatters, and How Can They Help You with Code Consistency?
|
||||
challengeType: 11
|
||||
videoId: XDPvu4bk8IA
|
||||
challengeType: 19
|
||||
dashedName: what-are-linters-and-formatters-and-how-can-they-help-you-with-code-consistency
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What are linters and formatters, and how can they help you with code consistency?
|
||||
|
||||
In the world of software development maintaining clean, consistent and error-free code is important. This is where linters and formatters come into play. These tools are essential for developers to ensure code quality and consistency across projects and teams.
|
||||
|
||||
Let's start with linters. A linter is a static code analysis tool that flags programming errors, bugs, stylistic errors, and suspicious constructs. The term lint comes from a Unix utility that examines C language source code.
|
||||
|
||||
+2
-9
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 6732c6d4dec34c61850a1276
|
||||
title: What Is Memory Management, and How Does It Work in JavaScript?
|
||||
challengeType: 11
|
||||
videoId: HJF89E-ODlw
|
||||
challengeType: 19
|
||||
dashedName: what-is-memory-management-and-how-does-it-work-in-javascript
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is memory management, and how does it work in JavaScript?
|
||||
|
||||
Memory management is an essential concept in programming, but it can be a bit confusing for beginners, let's break it down in simple terms.
|
||||
|
||||
When you run a program, including JavaScript code in a web browser, it needs memory to store all the information its working with. This includes variables, functions, objects, basically everything your code creates and uses. Memory management is the process of controlling this memory, allocating it when needed, and freeing it up when it's no longer needed. In some programming languages, developers have to manually manage memory. They need to explicitly tell the computer when to allocate memory for new things and when to free up memory that's no longer needed. This can be powerful but also tricky as forgetting to free memory can lead to memory leaks.
|
||||
@@ -38,7 +31,7 @@ let printArrayLength = createLargeArray();
|
||||
printArrayLength();
|
||||
```
|
||||
|
||||
In this code, even after `createLargeArray` finishes running, `largeArray` can't be garbage collected because the returned function still has access to it. This is a closure, and while closures are useful they can sometimes lead to more memory usage than you might expect. You will learn more about closures in future lecture videos.
|
||||
In this code, even after `createLargeArray` finishes running, `largeArray` can't be garbage collected because the returned function still has access to it. This is a closure, and while closures are useful they can sometimes lead to more memory usage than you might expect. You will learn more about closures in future lectures.
|
||||
|
||||
As a beginner, you don't need to worry too much about the intricacies of memory management. JavaScript's automatic garbage collection takes care of most things for you. However, as you advance in your JavaScript journey, understanding these concepts can help you write more efficient code, especially for larger applications or when working with limited resources.
|
||||
|
||||
|
||||
+1
-8
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 6732c6e281c14a61c4858361
|
||||
title: What Are Closures, and How Do They Work?
|
||||
challengeType: 11
|
||||
videoId: J4ZBwMbDAgE
|
||||
challengeType: 19
|
||||
dashedName: what-are-closures-and-how-do-they-work
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What are closures, and how do they work?
|
||||
|
||||
Closures are one of the most powerful and often misunderstood features in JavaScript. At its core, a closure is a function that has access to variables in its outer enclosing lexical scope, even after the outer function has returned. This might sound complex but it's a fundamental concept that enables many advanced programming patterns in JavaScript.
|
||||
|
||||
To understand closures, let's start with an example:
|
||||
|
||||
+1
-8
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 67329f9e9eb84e5c6a5e4366
|
||||
title: What Is a String Object, and How Does It Differ from String Primitive?
|
||||
challengeType: 11
|
||||
videoId: _-EJRG7vr-0
|
||||
challengeType: 19
|
||||
dashedName: what-is-a-string-object-and-how-does-it-differ-from-string-primitive
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is a string object, and how does it differ from a string primitive in JavaScript?
|
||||
|
||||
In previous modules you have been used to working with strings literals like this:
|
||||
|
||||
```js
|
||||
|
||||
+2
-9
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 6732c68f4520d160584a6fd2
|
||||
title: What Is the toString() Method, and How Does It Work?
|
||||
challengeType: 11
|
||||
videoId: OYOHw8Xmatw
|
||||
challengeType: 19
|
||||
dashedName: what-is-the-tostring-method-and-how-does-it-work
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is the `toString()` method and how does it work?
|
||||
|
||||
The `toString()` method is a fundamental feature in JavaScript that converts a value to its string representation. It's a method you can use for numbers, booleans, arrays, and objects. One of the most common uses of `toString()` is to convert a number to its string representation. Here's an example:
|
||||
|
||||
```js
|
||||
@@ -51,7 +44,7 @@ const person = {
|
||||
console.log(person.toString()); // "[object Object]"
|
||||
```
|
||||
|
||||
In this example, the result will be the default string representation for the object which is `[object Object]`. To get a stringified version of the `person` object properties you'll need to use `JSON.stringify()` which you will learn about more in the future lecture videos.
|
||||
In this example, the result will be the default string representation for the object which is `[object Object]`. To get a stringified version of the `person` object properties you'll need to use `JSON.stringify()` which you will learn about more in the future lectures.
|
||||
|
||||
In conclusion, the `toString()` method is used for converting values to strings. Understanding how it works with different data types and how to customize it for your own objects can greatly advance your ability to manipulate and display data in your JavaScript applications.
|
||||
|
||||
|
||||
-8
@@ -1,20 +1,12 @@
|
||||
---
|
||||
id: 6732c69d82814160951b1aa7
|
||||
title: What Is the Number Constructor, and How Does It Work for Type Coercion?
|
||||
# change back to 11 when video is updated
|
||||
challengeType: 19
|
||||
# videoId: new-id-goes-here-when-ready
|
||||
dashedName: what-is-the-number-constructor-and-how-does-it-work-for-type-coercion
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is the `Number()` constructor and how does it work for type coercion?
|
||||
|
||||
The `Number()` constructor is used to create a number object. The number object contains a few helpful properties and methods like the `isNaN` and the `toFix` method. Here's an example using the `Number()` constructor with the `new` keyword:
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user