当前位置:网站首页>Application of map function in JS
Application of map function in JS
2022-06-23 03:05:00 【It workers】
map function
Let's first review ,map First argument to function callback:
var new_array = arr.map(function callback(currentValue[, index[, array]]) {
// Return element for new_array
}[, thisArg])This callback You can receive three parameters , The first parameter represents the element being processed , The second parameter represents the index of the element .
parseInt function
parseInt Cardinality is a value between 2 and 36 Integer between .
parseInt(string, radix) // Receive two parameters , The first represents the value being processed ( character string ), The second is the cardinality of parsing .
Simulation
After understanding these two functions , We can simulate the operation .
parseInt('1', 0) //radix by 0 when , And string Parameter is not in “0x” and “0” At the beginning , according to 10 Processing for cardinality . This time back 1
parseInt('2', 1) // The base number is 1(1 Base number ) In the number represented by , Less than the maximum 2, So I can't parse , return NaN
parseInt('3', 2) // The base number is 2(2 Base number ) In the number represented by , Less than the maximum 3, So I can't parse , return NaNmap Function returns an array , So the end result is [1, NaN, NaN]
边栏推荐
- 2022-02-05: the k-th decimal number of dictionary order. Given integers n and K, find 1
- Methods for MySQL to avoid inserting duplicate records
- Markdown - mark above / below symbol (typora, latex)
- January 31, 2022: Maze III. There is a ball in the maze of open spaces and walls. ball
- Transformation solution of digital intelligent supply chain platform for project management in engineering industry
- Aiot application innovation competition - Smart street lamp (developed with keil)
- Gorilla/mux framework (RK boot): add swagger UI
- February 4, 2022: combined total IV. Give you a number composed of different integers
- DNS Service Setup
- February 2, 2022: the closest binary search tree value II. Given a non empty two
猜你喜欢

Vulnhub DC-5

6. template for integer and real number dichotomy

Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027

C language series - Section 4 - arrays
What is sitelock? What is the function?

5. concept of ruler method

8. greed

Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030

How to store, manage and view family photos in an orderly manner?
随机推荐
What if the software gets stuck and cannot end the process?
Direct collection - super easy to use domestic color matching website
No error is reported when using the Gorm framework to create a table, but the data cannot be inserted successfully
Interrupt array Foreach method [js implementation]
Cve-2021-4034 reappearance
Section 6: basic configuration I of spingboot
2022-02-05: the k-th decimal number of dictionary order. Given integers n and K, find 1
MySQL gets the top 1 and top n records after grouping
Qingdao stadium has made headlines again, but it has nothing to do with sports
Aiot application innovation competition - Smart street lamp (developed with keil)
method
Autowired usage
How does easyplayer embed a video snapshot into a demo?
2022-01-28: for example, {5, 3, 1, 4} all number pairs are: (5,3), (5,1)
Chaoscraft: join your girlfriend in Hackathon show -- Interview with the skate team
HTTP cache
Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027
The logical operators |, & &!
Enterprise official website applet building tutorial - solution
Vulnhub DC-5