Day 17
Today I am learning Objects and Arrays... FUN!
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ch8 JavaScript Objects and Arrays</title>
</head>
<body>
<h1>Looping can make your code spin!</h1>
<input type="button" id="looper" value="Do it again!">
<p id="target"></p>
<script>
document.getElementById("looper").onclick=function()
{
var dogs = [
"German Shepherd",
325425,
" Beagle",
" Boxer",
" Chimpdog"
];
dogs.push("Pushing Dog");
for (index = 0; index < dogs.length; index++)
{
alert(dogs[index]);
}
var pets = ["Pets", "Pets2", dogs, false];
alert(dogs.length);
document.getElementById("target").innerHTML = pets[2];
}
</script>
</body>
</html>
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ch8 JavaScript Objects and Arrays</title>
</head>
<body>
<h1>Looping can make your code spin!</h1>
<input type="button" id="looper" value="Do it again!">
<p id="target"></p>
<script>
document.getElementById("looper").onclick=function()
{
var dogs = [
"German Shepherd",
325425,
" Beagle",
" Boxer",
" Chimpdog"
];
dogs.push("Pushing Dog");
for (index = 0; index < dogs.length; index++)
{
alert(dogs[index]);
}
var pets = ["Pets", "Pets2", dogs, false];
alert(dogs.length);
document.getElementById("target").innerHTML = pets[2];
}
</script>
</body>
</html>
Comments
Post a Comment