function factor(){ let result = ''; if(peek() > '0' && peek() < '9') return number();
calc('9+1') return emtpy string
calc('9+1')
so, You should write if(peek() > '0' && peek() <= '9').
if(peek() > '0' && peek() <= '9')
LOL...
Thank you, you are right.
Hello, after listening to your advice,
I have made some tests as follows, but I have not found that Array.from is slower than [...Arr].
Array.from
[...Arr]
console.time("timer") obj=document.querySelectorAll('a') for(let i=1;i<9999999;++i){obj[i]=i} [...obj] console.timeEnd("timer"); VM299:5 timer: 948.02685546875ms console.time("timer") obj=document.querySelectorAll('a') for(let i=1;i<9999999;++i){obj[i]=i} Array.from(obj) console.timeEnd("timer"); VM300:5 timer: 943.575927734375ms console.time("timer") obj=document.querySelectorAll('a') for(let i=1;i<999;++i){obj[i]=i} [...obj] console.timeEnd("timer"); VM340:5 timer: 0.406005859375ms console.time("timer") obj=document.querySelectorAll('a') for(let i=1;i<999;++i){obj[i]=i} Array.from(obj) console.timeEnd("timer"); VM341:5 timer: 0.410888671875ms
Google chrome Version 65.0.3325.181 ( official version ) ( 64 bits )
I guess it must have something to do with V8.
Loading collection data...
calc('9+1')
return emtpy stringso, You should write
if(peek() > '0' && peek() <= '9')
.LOL...
Thank you, you are right.
Hello, after listening to your advice,
I have made some tests as follows, but I have not found that
Array.from
is slower than[...Arr]
.My Configuration
Google chrome
Version 65.0.3325.181 ( official version ) ( 64 bits )
I guess it must have something to do with V8.