writes its formatted output into a string pointer passed as one of its arguments. code example
Example 1: Use parseInt() in the convertToInteger function so it converts the input string str into an integer, and returns it.
function convertToInteger(str) {
return parseInt(str);
}
Example 2: create a function that takes in an array of numbers and returns only the number that are even after 1 is added to the value
const evenAfter = (arr) => {
let i = 0
let newArr = []
while (i <= arr.length) {
if ((arr[i] + 1) % 2 === 0){
newArr.push(arr[i])
}
i++
}
return newArr
}
console.log(evenAfter([3,6,7,8,9,11]))