Check out example codes for "random game idea generator". It will help you in understanding the concepts better.

Code Example 1

<!-- Use the code below to genorate game ideas. -->
<!-- Do not remove the comment below -->
<!-- The Code Below was coded by Catking -->
<html>
<head>
<title>
	Game Idea Genorator
</title>
</head>
<body>
<style>
html, body {
	background-color: lightgrey;
}
h1 {
	background-color: grey;
}
      }
</style>
<buttton onclick="genorateIdea()">
	<h1>
		Genorate Idea
	</h1>
</buttton>
<h1 id="txt"></h1>
<script>
var themes = [
"fantasy", "adventure", "survival", "good vs. evil", "retro", "8-bit"]
var goals = [
"escape the cave", "esape the faculty", "find the cave", "find the secret map", "find the tresure"];
var characters = [
"flower", "skeleton", "pig", "hero", "spider", "vilian", "ballon", "cat", "spy", "pirate",
"bee", "person"]
var places = [
"forest", "cave", "city", "farm", "space", "underground", "alien planet", "mars", "house"
]
function random(words) {
	return words[Math.floor(Math.random() * words.length)];
}
function genorateIdea() {
var txt = document.getElementById("txt");
var gameIdea = "Make a game where the theme is " + random(themes) + ", and you are a " + random(characters) + ". Your enemy is a " + random(characters) + ",  and the game takes place at " + random(places) + ".";
txt.innerHTML = gameIdea;
}
</script>
</body>
</html>

Learn ReactJs, React Native from akashmittal.com