@fengxh
front-end developer
Nothing here yet.
Nothing here yet.
Sometimes, the type of data which are retrieved from apis is bitter vague, such as { code: 2, name: 'fengxh', type: 'human' } or { code: '2', type: 'clothes' }, from two different apis. So more codes to directly use === , unless a workaround +code === 2 . But I still recommend using ===
I'm sorry, but there is an error in javascript code about ternary operator let age = 17 if (age >= 18 ){ console .log( " You are old enough to vote" ); } else { console .log( "Come back when you are 18" ); } // Ternary Operator if age >= 18 ? console .log( " You are old enough to vote" ) : console .log( "Come back when you are 18" ); // here we don't need if identifier, just remove it
Hi Tomasz: I'm a middle level front-end engineer, and my projects are mostly about websites and back-end management systems. I have worked for 5 years after graduated from high school, and now I get a little confused about how to reach a higher level, how to prep myself to build more featured works. And what's your path to senior engineer. Thanks a lot.
You can use reduce to finish the multiply action. function multiply ( arr ) { if (arr.length <= 0 ) return 1 ; return arr.reduce( ( result, number ) => { return result * number ; }, 1 ); } Another thing about recursion is tail optimization, it can reduce the usage of call stack to minimize space complexity.