Answer the question
In order to leave comments, you need to log in
How to replace null in an array?
Good afternoon! Can you please tell me how to improve this?
const types = [
null,
null,
'OPEN_MODAL',
'CLOSE_MODAL',
];
Answer the question
In order to leave comments, you need to log in
const types = [];
types[2] = 'OPEN_MODAL';
types[3] = 'CLOSE_MODAL';
The very fact that 'OPEN_MODAL must necessarily be at array index 2, and CLOSE_MODAL - at 3 does not look very good.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question