Skip to content

Commit 20a4a5e

Browse files
committed
Function #30: added
1 parent 56fabed commit 20a4a5e

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Problem.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#27: Create a function that takes an array and returns the types of values (data types) in a new array.
2828
#28: Create a function that will return in an array. becarefull function parameter and array length is same in count.
2929
#29: Create a function that takes the age in years and returns the age in days.
30-
30+
#30: Create a function that takes voltage and current and returns the calculated power.
3131

3232

3333

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,12 @@ const calcAge = (age) => (age < 0 || typeof age != "number" ? null : age * 365);
419419
console.log(calcAge(5));
420420
421421
```
422+
423+
**#30: Create a function that takes voltage and current and returns the calculated power.**
424+
425+
```
426+
427+
const circuitPower = (voltage, current) => voltage * current;
428+
console.log(circuitPower(115, 5));
429+
430+
```

script.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ console.log(getArray(5));
266266
const getArray = (n) => Array(...Array(n)).map((v, i) => i + 1);
267267
console.log(getArray(5));
268268
269-
*/
270-
271269
// #29: Create a function that takes the age in years and returns the age in days.
272270
const calcAge = (age) => (age < 0 || typeof age != "number" ? null : age * 365);
273271
console.log(calcAge(5));
272+
273+
*/
274+
275+
// #30: Create a function that takes voltage and current and returns the calculated power.
276+
const circuitPower = (voltage, current) => voltage * current;
277+
console.log(circuitPower(115, 5));

0 commit comments

Comments
 (0)