Skip to content

Latest commit

 

History

History
20 lines (10 loc) · 1.92 KB

File metadata and controls

20 lines (10 loc) · 1.92 KB

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 introduced to be able to shuffle the array with a 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 believed y'all has an indepth understanding on what happened on the step 1 of my program on how to shuffle an using sort method step 1. 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 this code first before using it. because It'll go a very 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. looking forward for y'all reviews and comments on the discussion section or you can contact me directly if you have any difficulties on the program. also, I'm always open to new ideas that will sharpen and impact my skills positively. Thank y'all and you're welcome!🙃