JSFiddle - React, Tailwind, and code Playground

by MuLtDirectX

JavaScript

let str = "2 4 7 8 10"

let res = str.split('').filter(e => (e!==' ')).map(e => +e)

console.log(res)
/*
res.forEach(e => {if (e%2) {console.log(e)}} )

*/