课程: JavaScript Essential Training
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Pass data to a function with parameters - JavaScript教程
课程: JavaScript Essential Training
Pass data to a function with parameters
- [Instructor] Functions are a great tool for using or transforming data in some ways. So let's break this down further, so you can get a firm handle on how functions work. For us to be able to pass data, we need to be able to pass that data to the function in the first place. And this is done by passing arguments through function parameters. To explain, let's build a basic example, a tip calculation function. I've already built the framework for the function for you, except, this function isn't very useful right now. It calculates the tip of 18% for the value 29.95. And no matter how many times you run it, it will only ever give you these values and nothing else. What we want to be able to do, what would make this function useful to us, would be to pass a sum and a percentage number into the function and then it will return the tip and total for us for whatever values we pass in. To do that, we need to specify our…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
-
-
-
The real-world function2 分钟 49 秒
-
(已锁定)
Functions and methods6 分钟 23 秒
-
(已锁定)
A standard function3 分钟 53 秒
-
(已锁定)
The arrow function4 分钟 49 秒
-
(已锁定)
Arrow functions and "this"4 分钟 20 秒
-
(已锁定)
Practice: Build a function1 分钟 31 秒
-
(已锁定)
Pass data to a function with parameters4 分钟 56 秒
-
(已锁定)
Return values from a function7 分钟 1 秒
-
(已锁定)
Practice: Pass values between functions2 分钟 33 秒
-
(已锁定)
Callbacks5 分钟 29 秒
-
(已锁定)
Conditional if...else statement5 分钟 52 秒
-
(已锁定)
Logical operators3 分钟 31 秒
-
(已锁定)
Conditional switch statement5 分钟 55 秒
-
(已锁定)
Looping through content5 分钟 19 秒
-
(已锁定)
Using the map() array method4 分钟 52 秒
-
(已锁定)
Challenge intro: Create a content factory2 分钟 36 秒
-
(已锁定)
Solution: Create a content factory5 分钟 21 秒
-
-
-
-