Skip to main content

All Questions

Tagged with
2 votes
2 answers
186 views

Should special case be inside or outside the for loop here?

For example, suppose I have 2 arrays: let arr1=[5,2,1]; let arr2=["abcde","ab","a"]; my work is simple : to check if length of strings in arr2 are larger than corresponding element with same index in ...
ocomfd's user avatar
  • 5,750
9 votes
2 answers
11k views

Is it good practice to use array.pop() assignment in a while loop condition?

Just saw a code snippet that used an array pop assignment in the while condition; was wondering if this is acceptable/good practice? var arr = [0,1,2,3,4,5]; var current; while (current = arr.pop()) {...
flewk's user avatar
  • 103