Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

conditional array element js

const cond = false;
const arr = [
  ...(cond ? ['a'] : []),
  'b',
];
Source by 2ality.com #
 
PREVIOUS NEXT
Tagged: #conditional #array #element #js
ADD COMMENT
Topic
Name
9+3 =