Skip to main content

All Questions

2 votes
2 answers
509 views

Should I use Array or Set if both can be used to finish my task?

for example, Suppose I have a 2d array: let filterArr=[ [1,1,0,1,1], [0,1,1,1,0], [1,1,0,1,0] ]; I want to find and store the index of column that all are 1, i.e.:position 1 and 3, and the ...
ocomfd's user avatar
  • 5,750
2 votes
1 answer
2k views

How should I define hardcoded strings with some variable parts? Reuse more characters? Or keep the whole sentence?

for example, sometimes I need to define a hardcoded string with some variable parts, I often have trouble to choose the style: style 1 : reuse every characters when possible showMessage(num){ let ...
ocomfd's user avatar
  • 5,750