For this Question: Write a JavaScript function with function name <code>first</code> to return the first n elements of an array. 
The function takes two arguments <code>array</code> and number <code> n </code>
Passing a parameter 'n' will return the first 'n' elements of the array.
The function will be tested as follows <code> first(array, n) </code>

Note to use Generate Expected Output section
Pass input like this 
<code>
5 4 2 1
1
</code>The function <code>first<code> accepts two arguments
- array which is an array like [1,2,3] 
- n which is a number like 2Return the array of first n numbers of array.const inputArray = [5,4,3,2,1]
const newArrayOfFirst2Numbers = first(inputArray,2)
console.log(newArrayOfFirst2Numbers) [5,4], I have written this Solution Code: const first = function (array, n) {
  if (array == null) return void 0;
  if (n == null) return array[0];
  if (n < 0) return [];
  return array.slice(0, n);
};
, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?