I am still very much a beginner and having issues with the below section. Currently using Zapier in order to take the inputData and split it into the 3 different calculations before combining them and spitting that result back out again.
1st digit, 2nd & 3rd digit and the last 3 are all handled separately as below.
The error I'm getting is that .slice is not a valid function. Hope someone can help :)
var inputData = '123456'
// Convert to ABC
var codeA= parseInt(inputData[0], 10) * 60 * 1000;
var codeB = parseInt(inputData.slice(1,3), 10) * 1000;
var codeC = parseInt(inputData.slice(3,6), 10);
You can use substr where there first parameter is the start position and the second parameter is the length:
var inputData = '123456'
// Convert to ABC
var codeA= parseInt(inputData[0], 10) * 60 * 1000;
var codeB = parseInt(inputData.substr(1,2), 10) * 1000;
var codeC = parseInt(inputData.substr(3,3), 10);
console.log(codeA)
console.log(codeB)
console.log(codeC)