Answer the question
In order to leave comments, you need to log in
How to solve a type conversion problem when NaN gets in the way?
var someArray = ['3232', 'sdfdsf', 'gfdgdsf', '23423', '54534']
someArray.map(i => {
if (если строка с числами) {
// тут что-то делается
} else if (если строка с символами) {
// и здесь что-то делается
}
})
Answer the question
In order to leave comments, you need to log in
1. Open Youtube
2. Write something like "wordpress landing"
3. Watch
4. Do it
5. Profit
Very difficult, of course, but try it.
Check for NaN with the isNaN special function and you'll be fine. Returns true if the result is NaN, and false for any other value.
Elementary:
var someArray = ['3232', 'sdfdsf', 'gfdgdsf', '23423', '54534']
someArray.map(i => {
if (!isNaN(i)) {
// делай что-то с числами
} else {
// делай что-то со строками
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question