Try this
function split_at_index(value, index)
{
return value.substring(0, index) + "," + value.substring(index);
}
console.log(split_at_index('3123124', 2));
More Related Contents:
- Replacing live with on function [closed]
- Counting the occurrences / frequency of array elements
- Using variable keys to access values in JavaScript objects
- Firebase: setting additional user properties
- Call javascript function after script is loaded
- Including both href and onclick to HTML tag
- Firestore: What’s the pattern for adding new data in Web v9?
- How to detect timeout on an AJAX (XmlHttpRequest) call in the browser?
- Simple pagination in javascript
- Content Security Policy: The page’s settings blocked the loading of a resource
- List files in a directory using only javascript
- Why {} != ( {} ) in JavaScript?
- How do I use the Spacing Utility Classes in Bootstrap
- offsetTop vs. jQuery.offset().top
- Why is PassportJS in Node not removing session on logout
- Cancel event on input type=”file”
- Convert HSB/HSV color to HSL
- correctly implement backbone comparators
- What is JavaScriptExecutor in Selenium?
- Javascript – Stop form submit depending on ajax response [duplicate]
- Find all values by specific key in a deep nested object
- es6 – import all named module without alias
- First item from a Map on JavaScript ES2015
- return false the same as return?
- Regex in JavaScript for validating decimal numbers
- chrome.tabs.executeScript(): How to get result of content script?
- Get value from AJAX using Javascript and ASP
- jQuery addClass onClick
- Retrieving which tabs are open in Chrome?
- How do you round to one decimal place in JavaScript?