mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
chore(curriculum): rm vids from js functions lectures (#61615)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
+4
-11
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 672d269da46786225e3fe3fd
|
||||
title: What Is the Purpose of Functions, and How Do They Work?
|
||||
challengeType: 11
|
||||
videoId: maLeO3YCqxs
|
||||
challengeType: 19
|
||||
dashedName: what-is-the-purpose-of-functions-and-how-do-they-work
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is the purpose of functions, and how do they work?
|
||||
|
||||
Functions are reusable pieces of code that perform a specific task or calculate a value. Think of functions as a machine that takes some input, does some operations on it, and then produces an output. Here is an example of declaring a function:
|
||||
|
||||
```js
|
||||
@@ -162,7 +155,7 @@ function sum(num1, num2) {
|
||||
|
||||
### --feedback--
|
||||
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
Review the section where function calls were discussed.
|
||||
|
||||
---
|
||||
|
||||
@@ -172,7 +165,7 @@ Review the first minute of the video where function calls were discussed.
|
||||
|
||||
### --feedback--
|
||||
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
Review the section where function calls were discussed.
|
||||
|
||||
---
|
||||
|
||||
@@ -188,7 +181,7 @@ sum()
|
||||
|
||||
### --feedback--
|
||||
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
Review the section where function calls were discussed.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
|
||||
+3
-10
@@ -1,20 +1,13 @@
|
||||
---
|
||||
id: 673284d5e52ef81a2169b097
|
||||
title: What Are Arrow Functions, and How Do They Work?
|
||||
challengeType: 11
|
||||
videoId: EVrZqQ7Y3So
|
||||
challengeType: 19
|
||||
dashedName: what-are-arrow-functions-and-how-do-they-work
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What are arrow functions, and how do they work?
|
||||
|
||||
In the previous lecture video, you learned how to work with functions, which are reusable pieces of code that help make your code more modular, easier to maintain, and more efficient. All previous examples used the regular function syntax, like this:
|
||||
In the previous lecture, you learned how to work with functions, which are reusable pieces of code that help make your code more modular, easier to maintain, and more efficient. All previous examples used the regular function syntax, like this:
|
||||
|
||||
```js
|
||||
function greetings(name) {
|
||||
@@ -90,7 +83,7 @@ The reason why you are getting this error, is because you need to remove the `re
|
||||
const calculateArea = (width, height) => width * height;
|
||||
```
|
||||
|
||||
So when should you use the arrow function syntax? Well, it depends. Many developers use it consistently in their personal projects. However, when working on a team, the choice usually depends on whether the existing codebase uses regular functions or arrow functions. In future lecture videos, we'll cover when to use arrow functions and when to avoid them.
|
||||
So when should you use the arrow function syntax? Well, it depends. Many developers use it consistently in their personal projects. However, when working on a team, the choice usually depends on whether the existing codebase uses regular functions or arrow functions. In future lectures, we'll cover when to use arrow functions and when to avoid them.
|
||||
|
||||
# --questions--
|
||||
|
||||
|
||||
+1
-8
@@ -1,19 +1,12 @@
|
||||
---
|
||||
id: 673284e7244c0c1a649121b9
|
||||
title: What Is Scope in Programming, and How Does Global, Local, and Block Scope Work?
|
||||
challengeType: 11
|
||||
videoId: saSaw-VOFuo
|
||||
challengeType: 19
|
||||
dashedName: what-is-scope-in-programming-and-how-does-global-local-and-block-scope-work
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is scope in programming, and how does global, local, and block scope work?
|
||||
|
||||
Scope in programming refers to the visibility and accessibility of variables in different parts of your code. It determines where variables can be accessed or modified. In JavaScript, understanding scope is crucial for writing clean, efficient, and bug-free code. There are three main types of scope: global scope, local scope, and block scope.
|
||||
|
||||
Global scope is the outermost scope in a JavaScript program. Variables declared in the global scope are accessible from anywhere in your code, including within functions and blocks. These variables are often called global variables. While global variables can be convenient, they should be used sparingly as they can lead to naming conflicts and make your code harder to maintain. Here's an example of a global variable:
|
||||
|
||||
Reference in New Issue
Block a user