I need to extract the date from json :
/Date(1224043200000)/
I saw That I can do it by :
var date = new Date(parseInt('/Date(1224043200000)/'.substr(6)));
^
|
------------------------------0123456
But how does substr knows to ignore the last chars ?
[)/]
I’ve searched at mdn , but couldn’t find the documented behaviour.
.substr()return everything after the 6th char.But
parseInt()will parse all numeric chars until it reaches a non numeric char, so the ignoring happens byparseIntQuoting the docs