This is an array,
total = [\"10%\", 1000, \"5%\", 2000] . how can i filter these into two array like, percentage = [\"10%\",\"5%\"] and absolute = [100
total = [\"10%\", 1000, \"5%\", 2000]
let total = ["10%", 1000, "5%", 2000]; let percents = total.filter(item => item.toString().includes('%')); let numbers = total.filter(item => !item.toString().includes('%')); console.log(percents, numbers);