-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solution #335
base: master
Are you sure you want to change the base?
solution #335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if the number of arguments is incorrect, cp function will still be called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will show error but the cp function will run. You only show the error in the console it will still proceed with the code execution after that.
if (args.length !== 2) { | ||
console.error('Usage: node yourScript.js <source> <destination>'); | ||
|
||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean for you to move this condition inside function but rather to add else statement so that if an error occurs there's no need to run the function ;)
No description provided.