-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion
12 lines (10 loc) · 1.73 KB
/
version
1
2
3
4
5
6
7
8
9
10
11
12
Shuffle array using sort method step2
To begin with, I'm so happy about what am about to share with y'all today.on one hand,when we talk about shuffling of array it's easy to think of the steps to use when writing your algorithm to solve the probelm.on the other hand,getting your array shuffle after stating your steps is another issue to work on. that will lead us to the algorithm I used to solve the problem.
Before getting us to what we need to know know, I want to let y'all know that this program might be one of the shortest code you've seen so far been used to shuffle an array with javascript.
My algorithm are as follows:
step1: create a veriable and call it name or what you wish.
step2: create an array container that will hold your veriables.
step3: then use sort method to sort the array in the container using an alert()
step4: after which, a simple function was written to be able to shuffle the array with Math function merged simultaneously without any conflict. just like a nested function,writing a function inside of another funtion which can be called a method in javascript.
However, i believe y'all has an indepth understanding on what happened on the step 1 of my program. if you do then congratulation you're ready to advance and will be able to undertsand what will happen on the step 2.
NOTE: If you'd ask for my advise, on my end I'll encourage anyone using this program to understand what happened on the code first before using it. because It'll go a long way for you. that been said, I'd love y'all to compare and contrast step1 and stpe2 on how to shuffle array using sort method. will love to get your reviews and comments on the discussion section also I'm always open to new ideas and advise. Thank y'all and you're welcome!🙃