Convert String Array to int Array.
JavaScript Code:
1 2 3 4 5 6 7 8 9 10 |
const arrOfStr = ['1', '2', '3']; const arrOfNum = arrOfStr.map(str => { return Number(str); }); // [1, 2, 3] console.log(arrOfNum); |
Output:

Convert String Array to int Array.
JavaScript Code:
1 2 3 4 5 6 7 8 9 10 |
const arrOfStr = ['1', '2', '3']; const arrOfNum = arrOfStr.map(str => { return Number(str); }); // [1, 2, 3] console.log(arrOfNum); |
Output:
Email validation is a crucial part of any web application or website that collects user data. By validating the email address, you can ensure that the data you collect is accurate and useful. JavaScript is a popular...
In JavaScript, checking if a string contains a substring is a common task that can be achieved in a number of ways. In this post, we will explore different methods to determine if a given string contains a substring...
The fetch API can be used in Alpine.js to interact with REST APIs and perform common operations such as sending and receiving data. By using the fetch API, you can make HTTP requests to retrieve or send data from or to...
The programming which allows computations based on the activities in a browser or by the activities performed by the user on the elements in a document is known as event-driven programming. An event is...
Tic-Tac-Toe game is a two players game. There will be a board of 3×3 table cells and 2 symbols in this game, one for each player. Both players can choose the symbol of their choice. Then they will mark the sign inside...
In today’s article I will discuss about difference between java and javascript. Many people think that JavaScript is a part of Java, but this is not true. Java and JavaScript are similar like Car and Carpet...
Add comment