I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
Your code is adding the values 0, 1, 2 to total (which are indices). You start with i=0 and increment i at each iteration of the for loop, so your total.push(i) is just adding the current value of i during that iteration to total. If you want to add the actual value of myArr, then you must reference it and the index of myArr you want to get.