Skip to content

Instantly share code, notes, and snippets.

View jayprajapati857's full-sized avatar
🏠
Working from home

Jaykumar Prajapati jayprajapati857

🏠
Working from home
View GitHub Profile
@jayprajapati857
jayprajapati857 / JsHelper.js
Last active February 28, 2019 13:49
Add an object at first place in an array
var list = data; // here data is itself an array
list.splice(0, 0,
{
definition_id: "-1", // key value pair
display_name: ""
}
);
function replaceAt(string, index, replace) {
return string.substring(0, index) + replace + string.substring(index + 1);