javascript - convert array of numbers that are strings into array of numbers -


ids_nn ["50348", "18646", "17963", "18184", "30703", "18016", "23225"] 

how make it:

[50348, 18646, 17963, 18184, 30703, 18016, 23225] 

i read these 2 posts:

how convert elements in array integer in javascript?

convert string array of integers

so, tried:

var bla = ids_nn.map(function (x) { return parseint(x, 10}) vm4765:2 uncaught syntaxerror: unexpected token }message: "unexpected token }"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: errorvm3550:847 injectedscript._evaluateonvm3550:780 injectedscript._evaluateandwrapvm3550:646 injectedscript.evaluate 

and

var bla = ids_nn.split(',').map(number) vm4648:2 uncaught typeerror: undefined not function 

this works me

var bla = ids_nn.map(function (x) { return parseint(x) }); 

you had mistake } , ), anyway don't need pass base


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -