All I need is a custom function to act as an native Array object. When I create an object it should act like same as the new Array(1,2,3,4)
. It should create an array of elements.
<script type="text/javascript">
function MyArray(){
}
MyArray.prototype=Array.prototype;
var collection = new MyArray(1, 2, 3, 4);
console.log(collection);
// My code should act like.
var coll= new Array(1,2,3,4);
console.log(coll);
</script>