Replace all 0 in an Array with random numbers

Okey, folks so here it is, a solution to replace all the 0os in an array with a number. In the beginning I succeeded replace all 0 with the same number. But then i wanted to replace them with different values, all based on a random number. Here is the solution, written in Javascript:




var myData = [];
myData.push(5, 10, 0, 0, 0, 30, 0, 0, 0, 0);

//kanske används vid ett senare tilfälle 
var random = Math.floor((Math.random() * 100) + 1);
var random1 = Math.floor((Math.random() * 100) + 1);
var random2 = Math.floor((Math.random() * 100) + 1);


for(var i = 0; i < myData.length; i++){
  for(nollor in myData){
  if(myData[i] === 0){
    myData[i] = random;  
    random = Math.floor((Math.random() * 100) + 1);   
    myData[i] = random;




How To Add Embedds From SPOTIFY To WORDPRESS

You can find a great tutorial on how to add a song or an album from Spotify to WordPress. Check it out here: WordPress Support.

The trick for it to work (if it doesn’t) is however to add the song(or album) link FIRST.This means that it should be on top of your post. Otherwise you may experience problems such as the post only showing the link or an empty embedd.

Can’t Connect To Internet? Try This Simple Trick

Many people everyday, worldwide, expercience issues when trying to connect to the Internet. What you should do in case your conncetion won’t work is to power off the router for at least 10-30 seconds then start again. If it won’t work, then try to restart your computer.

If it still won’t work, you may try to do the following

1.Go to the Search button or menu on your Windows computer
2.Type “cmd” without the quotes and start the program.
3.Now you should write “ipconfig/release” without the quotes and hit enter. Wait untill it’s done.
4.Next step is to type “ipconfig/renew” without the quote marks and push enter. Wait for it…. when it’s done, your internet connection should be back. I know it works because I am doing it every day.

If you like our articles, you may want to check out the “Tutorials” page.