练习题7:取出数组里面的负数
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
给出一个数组,数组里面的成员可是数值,字符串,对象,数组。找出里面所有的字符串
let arr=[-6.236,3,-21,{a:-11,b:{c:-10}},[11,2.26,[-1,-6,]]]
console.log(JSON.stringify(str).split('-').splice(1).map(item=>-Number.parseFloat(item)))
解题思路:首先把数组转成 json ,然后按照 ’-‘ 分割字符,把第一个元素删除,再用 Number.parseFloat 把字符串转成 数值
关键点:Number.parseFloat
Number.parseFloat('12asd31{{}') //12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JavaScript example in the issue body and clarify whether the exercise should find negative numbers or all strings. Check the JSON.stringify and parseFloat approach against the nested array and object shown, then update the exercise so its requested result, variable names, and completion condition are consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100