V
V
Ventus2020-04-26 13:22:12
JavaScript
Ventus, 2020-04-26 13:22:12

What is the best way to split a string in an "if" statement?

There is a conditional if statement that tests several conditions:

if (typeof(mandatory) === 'string'
        && typeof(mandatory) !== null
        && typeof(expenseAmount) !== null
        && mandatory !== ''
        && expenseAmount !== '') {
        console.log('done');
    }


Did I translate correctly to the next line? How is this often done in practice?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Ventus, 2020-04-26
@Ventus

The link in the comment to this question was given by TAbrahamyan : https://github.com/airbnb/javascript
I found the explanation in the paragraph. 17.1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question