实现一个函数 console.log(test(‘{[()]}‘)) // true console.log(test(‘{[(]]}‘)) // false
前两天看见一道简单的笔试题,简单记录一下写法。// 用js实现一个以下功能的函数//console.log(test(’{[()]}’)) // trueconsole.log(test(’{[(]]}’)) // falseconsole.log(test(’{]()]}’)) // falseconsole.log(test(’{()]}’)) // falsefunction test(s){ if(s.length %2 !== 0){ return false
原创
2021-11-24 22:21:53 ·
336 阅读 ·
0 评论