18.4k views
1 vote
var shirt = "blue"; 2. var pants = "gray"; 3. var clothes = wearIt(shirt, pants); 4. function wearIt( x, y) 5. { 6. var myOutfit = "Today I will wear a " + pants + 8 " shirt and " + shirt + " pants."; 7. return myOutfit; 8. } 9. document.write(clothes);What are the arguments and parameters in the code snipped?

1 Answer

4 votes

Answer:

Arguments: "blue" and "gray"

Parameters: x and y

Step-by-step explanation:

In programming, a function can take zero or one or more than one input values. These input value will be held by the variables which are called parameters. In this code snippet, x and y are parameters of wearIt function.

On another hand, when calling a function, we provide the values to the function and the values provided are termed as arguments. In this case, we provide the string blue and gray which are held by shirt and pants variables respectively to the function wearIt. The string "blue" and "gray" will then be passed to parameter x and y which will be processed in the function.

User Thiha Aung
by
4.9k points