Get the answers you need at Westonci.ca, where our expert community is dedicated to providing you with accurate information. Get quick and reliable solutions to your questions from knowledgeable professionals on our comprehensive Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

write a script to check command arguments. Display the argument one by one (use a for loop). If there is no argument provided, remind users about the mistake.

Sagot :

Answer and Explanation:

Using Javascript programming language, to write this script we define a function that checks for empty variables with if...else statements and then uses a for loop to loop through all arguments passed to the function's parameters and print them out to the console.

function Check_Arguments(a,b,c){

var ourArguments= [];

if(a){

ourArguments.push(a);}

else( console.log("no argument for a"); )

if(b){

ourArguments.push(b);}

else( console.log("no argument for b"); )

if(c){

ourArguments.push(c);}

else( console.log("no argument for c"); )

for(var i=0; i<ourArguments.length; i++){

Console.log(ourArguments[i]);

}

}