当前位置:网站首页>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]
边栏推荐
- JS asynchronous mechanism
- Initial xxE
- Interrupt array Foreach method [js implementation]
- How to set jewelry label paper
- How does easyplayer embed a video snapshot into a demo?
- Learning about urldns chains
- Extract NTDs with volume shadow copy service dit
- Transformation solution of digital intelligent supply chain platform for project management in engineering industry
- Chaoscraft: join your girlfriend in Hackathon show -- Interview with the skate team
- method
猜你喜欢

6. template for integer and real number dichotomy

5. concept of ruler method

Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030
What is sitelock? What is the function?

C language series - Section 4 - arrays

Vulnhub DC-5

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

How to store, manage and view family photos in an orderly manner?

8. greed
随机推荐
Reinforcement learning series (IV) -policygradient example
Implementation process of the new electronic amplification function of easycvr video fusion cloud platform
How to batch print serial and repeated barcode data
How to batch make decreasing serial number barcode
Integrated solution for intelligent supply chain platform management in rubber industry
2022-01-27: heater. Winter has come. Your task is to design a
Docker builds MySQL master-slave
Handlebars dynamic adjustment
Storage resources revitalize the system and redefine "hyper fusion"
Web components series (I) - Overview
Related concepts of TTF, TOF, woff and woff2
Precision loss problem
February 2, 2022: the closest binary search tree value II. Given a non empty two
Implementing StdevP function of Excel with PHP
Batch generation of Codabar codes using Excel files
The metauniverse is just a cloak for future technological evolution
How to make keyword targeted layout based on search sources?
Micro build low code to realize user login and registration
Docker builds redis3 master-slave cluster and expands the capacity
Markdown - enter a score (typora, latex)