diff --git a/insert-value-into-an-array/index.js b/insert-value-into-an-array/index.js new file mode 100644 index 0000000..c408977 --- /dev/null +++ b/insert-value-into-an-array/index.js @@ -0,0 +1,9 @@ +// https://www.codewars.com/kata/insert-value-into-an-array/javascript + +Object.defineProperty(Array.prototype, 'insert', { + enumerable: false, + value: function(idx, val) { + this.splice(idx, 0, val); + return this; + } +});