/**
* @param {number[]} nums
* @return {boolean}
*/
var canJump = function (nums) {
let maximum = 0;
if (nums.length <= 1) {
return true;
}
for (let i = 0; i < nums.length; i++) {
if (maximum <= i && nums[i] == 0) return false;
if (i + nums[i] > maximum) {
maximum = i + nums[i];
}
if (maximum >= nums.length - 1) return true;
}
return false;
};