当前位置:网站首页>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]
边栏推荐
- Implementation process of the new electronic amplification function of easycvr video fusion cloud platform
- Simple implementation of promise basic method
- Related concepts of TTF, TOF, woff and woff2
- SQLSERVER database restore stored procedure script
- 5. concept of ruler method
- Apache Druid's engineering practice in shopee
- Goframe framework (RK boot): fast implementation of CSRF verification
- Quic implementation in rust --- Quinn
- Xiamen's hidden gaopuge smart park has finally been uncovered
- 2022-01-27: heater. Winter has come. Your task is to design a
猜你喜欢

Vulnhub DC-5

6. template for integer and real number dichotomy

8. greed

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

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

5. concept of ruler method

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?
随机推荐
Quickly grab the red envelope cover of Tencent blue whale New Year! Slow hands!
Canvas draw the clock
Section 6: basic configuration I of spingboot
Related concepts of TTF, TOF, woff and woff2
JS to determine whether the page is opened for the first time today
Online signature with canvas
How to generate DataMatrix code in batch through TXT file
A penetration of an internal self built shooting range
How to use fortress on mobile devices
Pyqt5 installation and use
An article shows you the difference between high fidelity and low fidelity prototypes
[SaaS examination certification] apaas_ Tencent Qianfan magic pen
Daily shift series: memory problem of primary online service
JS event delegation (event agent)
Aiot application innovation competition -- I am the master of my project, and use gn+ninja to complete the system construction (vscode Development)
What is sitelock? What is the function?
Detailed explanation of online reputation management
Goframe framework (RK boot): fast implementation of server-side JWT verification
[data preparation and Feature Engineering] perceived data
2D visual empowerment smart water green intensive development