What is the algorithmic complexity of this?

I’m practicing leet code questions and want to understand more fully how to determine Big O notation. What is the algorithmic complexity of my solution to the following problem?

O(n^2) ? For every item in n I could loop an additional n[i] times. Or is it O(n) ?

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Determine if you are able to reach the last index.

Input: [2,3,1,1,4]

Output: true

Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.

var canJump = function(nums) {    let validIndices = {};   for(let i = nums.length - 1; i >= 0; i--) {     let currentNum = nums[i];      if(currentNum + i >= nums.length - 1) {       validIndices[i] = true;     } else {       while(currentNum > 0) {         if(validIndices[i + currentNum]) {           validIndices[i] = true;         }         currentNum--;       }     }   }    return !!validIndices[0]; };