Skip to content

Commit

Permalink
Update 283-Move-Zeroes.js
Browse files Browse the repository at this point in the history
Added a descriptive if condition.
  • Loading branch information
aadil42 committed Dec 25, 2022
1 parent 1614c33 commit a9a42da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion javascript/283-Move-Zeroes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var moveZeroes = function(nums) {
const zeroAtTheEnd = Array(nums.length).fill(0);
let left = 0;
for (let i = 0; i < nums.length; i++) {
if (nums[i]) {
const isNonZero = nums[i];
if (isNonZero) {
zeroAtTheEnd[left] = nums[i];
left++;
}
Expand Down

0 comments on commit a9a42da

Please sign in to comment.