CHALLENGE

Size
2,063 Kb
Views
50,600

How do I make an challenge?

What is a challenge? How do you make a challenge? This script and codes were developed by Milos Stankovic on 14 September 2022, Wednesday.

CHALLENGE Previews

CHALLENGE - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CHALLENGE</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

CHALLENGE - Script Codes JS Codes

// arrayevi sa recima
var myVerbs = [];
var myNouns = [];
var myAdjectives = [];
// ovako bi izgledalo da za svaki array pravimo posebno prompt
/*var verbsNumber = prompt("How many words?");
for(counter = 0; counter < verbsNumber; counter++){ counter2 = counter + 1; myVerbs[counter] = prompt("Your verb " + counter2 + " is:");
}
var nounsNumber = prompt("How many nouns?");
for(counter = 0; counter < nounsNumber; counter++){ counter2 = counter + 1; myNouns[counter] = prompt("Your noun " + counter + " is:");
}
var adjectivesNumber = prompt("How many adjectives?");
for(counter = 0; counter < adjectivesNumber; counter++){ counter2 = counter + 1; myAdjectives[counter] = prompt("Your verb " + counter + " is:");
}*/
// umesto toga smestimo u fju
var myInput = function(question) { var arr = []; var number = prompt(question); for(counter = 0; counter < number; counter++){ counter2 = counter + 1; arr[counter] = prompt("Your word " + counter2 + " is:"); } return arr;
};
// i koristeci tu fju, napunimo arrayeve recima
var myVerbs = myInput("How many verbs?");
var myNouns = myInput("How many nouns?");
var myAdjectives = myInput("How many adjectives?");
// podatke imamo, sad se izvrsava kod koji mesa reci
var puzzle = function(verb, noun, adjective) { var rand = function(max) { return(Math.floor(Math.random() * max) + 1); }; var checkUnique = function(str1, str2, type) { for (counter = 0; str2 == str1; counter++) { str2 = type[rand(type.length - 1)]; if(counter > 100) { return; } } return str2; }; this.verb1 = verb[rand(verb.length - 1)]; this.noun1 = noun[rand(noun.length - 1)]; this.noun2 = checkUnique(this.noun1, noun[rand(noun.length - 1)], noun); this.adjective1 = adjective[rand(adjective.length - 1)]; this.adjective2 = checkUnique(this.adjective1, adjective[rand(noun.length - 1)], adjective); return "I like to " + this.verb1 + ". My favorite " + this.noun1 + " is " + this.adjective1 + " " + this.noun2 + ". That's what makes me " + this.adjective2 + ".";
};
var sentence = puzzle(myVerbs, myNouns, myAdjectives);
// prikazujemo sta je napravljeno
console.log("HTML ", sentence);
alert(sentence);
CHALLENGE - Script Codes
CHALLENGE - Script Codes
Home Page Home
Developer Milos Stankovic
Username milstanyu
Uploaded September 14, 2022
Rating 3
Size 2,063 Kb
Views 50,600
Do you need developer help for CHALLENGE?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Milos Stankovic (milstanyu) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!