Adding element to the beginning of an Array
Given an array and a value, insert the value to the beginning of the array.
Sample Code:
function addEle(arr,ele) {
// Enter your logic here...
}
Examples:
Input: [1,2,3],0.9
Output: [0.9,1,2,3]
Explanation: Element 0.9 has been added to the array at index 0.
Input: [1,2,3],[0,'0.5']
Output: [[0,'0.5'],1,2,3]
Explanation: Element [0,'0.5'] has been added to the array at index 0.