javascripting
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -10,3 +10,3 @@ [ | ||
"NUMBER TO STRING", | ||
"IF-STATEMENT", | ||
"IF STATEMENT", | ||
"FOR LOOP", | ||
@@ -18,3 +18,4 @@ "ARRAYS", | ||
"OBJECT PROPERTIES", | ||
"FUNCTIONS" | ||
"FUNCTIONS", | ||
"FUNCTION ARGUMENTS" | ||
] |
{ | ||
"name": "javascripting", | ||
"description": "Learn JavaScript by adventuring around in the terminal.", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "url": "git://github.com/sethvincent/javascripting.git" |
@@ -13,5 +13,5 @@ var path = require('path'); | ||
run(args[0], function (err, result) { | ||
if (/hello/.test(result)) cb(true); | ||
if (/4140/.test(result)) cb(true); | ||
else cb(false); | ||
}); | ||
}; |
--- | ||
# | ||
# FUNCTION ARGUMENTS | ||
A function can be declared to receive any number of arguments. Arguments can be from any type. An argument could be a string, a number, an array, an object and even another function. | ||
Here is an example: | ||
```js | ||
function example (firstArg, secondArg) { | ||
console.log(firstArg, secondArg); | ||
} | ||
``` | ||
We can **call** that function with two arguments like this: | ||
```js | ||
example('hello', 'world'); | ||
``` | ||
The above example will print to the terminal `hello world`. | ||
## The challenge: | ||
Create a file named function-arguments.js. | ||
In that file, define a function named `math` that takes three arguments. It's important for you to understand that arguments names are only used to reference them. | ||
Name each argument as you like. | ||
The function `math` should multiply the second and third arguments, then add the first argument to the outcome of the multiplication and return the value obtained. | ||
After that, inside the parentheses of `console.log()`, call the `math()` function with the number 53 as first argument, the number 61 as second and the number 67 as third argument. | ||
Check to see if your program is correct by running this command: | ||
`javascripting verify function-arguments.js` | ||
--- |
--- | ||
# | ||
# YOU'RE IN CONTROL OF YOUR ARGUMENTS! | ||
Well done completing the excercise. | ||
Run `javascripting` in the console to choose the next challenge. | ||
--- |
--- | ||
# O-oh, something isn't working. | ||
But don't panic! | ||
Check next things: | ||
1) did you type the name of the file correctly? You can check by running `ls introduction.js`, if you see `ls: cannot access introduction.js: No such file or directory` then you should create new file / rename existing or change directories to the one with file | ||
2) make sure you didn't omit parens, since otherwise compiler would not be able to parse it | ||
3) make sure you didn't do any typos in the string itself | ||
@@ -5,0 +9,0 @@ --- |
@@ -14,4 +14,6 @@ --- | ||
Create a file named `introduction.js`. | ||
Create a file named `introduction.js`: | ||
`touch introduction.js` | ||
Add this text to the file: | ||
@@ -18,0 +20,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61465
351