My list is this: [ '030', '040', '050', '060', '070', '080', '090', '100', '110' ]
I wanted to know if it's possible to replace all zero's with nothing except the one in '100', in there i want just to replace the last one so it would be '10'.
let sizeCodes = body['items'][0]['product']['possibilities']['size']
let codeList = []
sizeCodes.forEach(sizeCode => {
sizeC = sizeCode['code']
codeList.push(sizeC)
})
codeList.forEach(code => {
let variants = body['items'][0]['product']['variantOptions']['variants'][`${code}`]['stockLevel']['stockLevel']
log('Size: ' + code.replace(/0/g, '') + ' | Stock: ' + variants, 'info')
})
This is what i tried but obviously that replaces all zero's. Also i don't want to do that in the actual array, the '030' stands for size 3, '040' for size 4, etc. i just want to make it look cleaner by outputing that instead.
arr.map(n => n / 10)