Created
May 5, 2017 17:26
-
-
Save ZeroX-DG/42d2fac4560fb4e3b8c69dc51b57835b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getData(text){ | |
var commandAndArgs = text.split(" "); | |
var command = commandAndArgs[0]; | |
var args = commandAndArgs[1]; | |
var arrayOfArgs = args.split("_"); | |
var arg1 = arrayOfArgs[0]; | |
var arg2 = arrayOfArgs[1]; | |
if(command == "calc"){ | |
return arg1 - arg2; | |
} | |
else{ | |
return false; | |
} | |
} | |
if(getData("calc 2_1")){ | |
console.log(getData("calc 2_1")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment