Create a calculator function that returns the result of addition, subtraction, multiplication or division of two numbers. Your function will accept three parameters:
- The first and second parameter should be numbers.
- The third parameter should represent a sign indicating the operation to perform on these two numbers.
Note: If the sign does not belong to the list of operations above, a message "unknown operator" must be returned.
// Example:
console.log(calculator(1,2,"+")); // 3
console.log(calculator(7,2,"-")); // 5
console.log(calculator(3,2,"*")); // 6
console.log(calculator(4,2,"/")); // 2
console.log(calculator(1,2,"&")); //"unknown operator"