Tell us what’s happening:
Just wanted to point out some issues with a lesson I am on:
Please find my solution below. My question is: is there a problem with using the .splice(i-10) code to create the solution? Happy for this to be used as a solution if there aren’t any issues from the more experienced community.
Thanks for your time.
Your code so far
var myArray = ;
var i = 0;
// Only change code below this line.
while (i < 11);
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0.
Link to the challenge:
Can’t link yet. Not allowed.
Can you explain your logic in using that? What it is you want to do, what do you think it is doing…
The only thing you need to do is change the loop to a do…while, anything else is just extra resources taken for nothing.
You don’t need to change the initial
var i = 10 or the comparison. Because even if
i < 5 is false the do … while loop still execute once
It’s not exactly a problem, but don’t you think it would be more efficient, if you’d just initiate i with value of -10? It would save you 11 substraction operations at least
This challenge just asks you to convert the while loop to a do while loop. The logic inside it is irrelevant.
better ask dumb questions here than those a*****s on stack-overflow
Dumb questions are those that are not asked!
(Resources is a thing you need to consider, later on if your solution is not optimised a bit you can’t pass the tests because they time out)