Write a function that does the following for the given values: add, subtract, divide and multiply. These are simply referred to as the basic arithmetic operations. The variables have to be defined, but in this challenge they will be defined for you. All you have to do is check the variables, do some string to integer conversions, use some if conditions, and apply the arithmetic operation.
The numbers and operation are given as strings and should result in an integer value.
operation("1", "2", "add" ) ➞ 3
operation("4", "5", "subtract") ➞ -1
operation("6", "3", "divide") ➞ 2
Infinity, then return "undefined" (e.g. division by zero).