“99 bottle of beer on the wall” code not working pure js. if statement and while loop
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Hi I have made a 99 bottles of beer song but my code does not seem to be working im not to sure and I cannot figure it out. I really need some help to see where I am going wrong or some one to show my where I am going wrong. I want to if statements or if there is a different way to do it but I need the set-up of how it is im not to sure how to fix it please help.
Thanks in advance.
This is my JavaScript.
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
bottles--;
output.innerHTML += text;
}
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
output.innerHTML += text;
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
This is my HTML.
<title>My Title</title>
<script src="javascript.js"></script>
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
I also have a fiddle.
http://jsfiddle.net/Matt1990/1wg16qr5/46/
javascript if-statement while-loop
add a comment |
Hi I have made a 99 bottles of beer song but my code does not seem to be working im not to sure and I cannot figure it out. I really need some help to see where I am going wrong or some one to show my where I am going wrong. I want to if statements or if there is a different way to do it but I need the set-up of how it is im not to sure how to fix it please help.
Thanks in advance.
This is my JavaScript.
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
bottles--;
output.innerHTML += text;
}
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
output.innerHTML += text;
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
This is my HTML.
<title>My Title</title>
<script src="javascript.js"></script>
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
I also have a fiddle.
http://jsfiddle.net/Matt1990/1wg16qr5/46/
javascript if-statement while-loop
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
i just did sorry
– Matthew
Sep 6 '14 at 9:46
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
how can i fix them
– Matthew
Sep 6 '14 at 9:51
add a comment |
Hi I have made a 99 bottles of beer song but my code does not seem to be working im not to sure and I cannot figure it out. I really need some help to see where I am going wrong or some one to show my where I am going wrong. I want to if statements or if there is a different way to do it but I need the set-up of how it is im not to sure how to fix it please help.
Thanks in advance.
This is my JavaScript.
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
bottles--;
output.innerHTML += text;
}
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
output.innerHTML += text;
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
This is my HTML.
<title>My Title</title>
<script src="javascript.js"></script>
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
I also have a fiddle.
http://jsfiddle.net/Matt1990/1wg16qr5/46/
javascript if-statement while-loop
Hi I have made a 99 bottles of beer song but my code does not seem to be working im not to sure and I cannot figure it out. I really need some help to see where I am going wrong or some one to show my where I am going wrong. I want to if statements or if there is a different way to do it but I need the set-up of how it is im not to sure how to fix it please help.
Thanks in advance.
This is my JavaScript.
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
bottles--;
output.innerHTML += text;
}
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
output.innerHTML += text;
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
This is my HTML.
<title>My Title</title>
<script src="javascript.js"></script>
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
I also have a fiddle.
http://jsfiddle.net/Matt1990/1wg16qr5/46/
javascript if-statement while-loop
javascript if-statement while-loop
edited Feb 17 '17 at 13:42
Cerbrus
50.2k1296117
50.2k1296117
asked Sep 6 '14 at 9:44
MatthewMatthew
2611
2611
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
i just did sorry
– Matthew
Sep 6 '14 at 9:46
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
how can i fix them
– Matthew
Sep 6 '14 at 9:51
add a comment |
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
i just did sorry
– Matthew
Sep 6 '14 at 9:46
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
how can i fix them
– Matthew
Sep 6 '14 at 9:51
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
i just did sorry
– Matthew
Sep 6 '14 at 9:46
i just did sorry
– Matthew
Sep 6 '14 at 9:46
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
how can i fix them
– Matthew
Sep 6 '14 at 9:51
how can i fix them
– Matthew
Sep 6 '14 at 9:51
add a comment |
5 Answers
5
active
oldest
votes
Your code is full of errors.
To debug client-side code like JavaScript you may use the developer tools in Chrome/Firefox by pressing CTRL + SHIFT + i. It shows syntax errors like the one in the variable declaration part.
For further reading see the Chrome DevTools Overview. Chrome Dev tools are by far better than Firefox/IE/whatever (IMHO)
Here is the working code. Please compare by yourself.
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
add a comment |
There are syntax errors - and logical errors:
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles >= 0) {
if (bottles == 1) {
bottle = "bottle";
}
// for all > 0
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles +
" " + bottle + " of beer. <br/>";
bottles--;
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " +
bottles + " bottles of beer on the wall. </p>"; // ; missing
} // } missing
output.innerHTML += text; // needs to be done always!
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
Fiddle here
2
bottles--;
needs to be moved out of theif
block
– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Moveif (bottles == 1){...}
beforetext = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes whenbottles
is 1. After the ifbottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.
– idmean
Sep 6 '14 at 9:58
|
show 2 more comments
Starting Condition
- We start with 99 bottles
- Since both 99 and 98 are plural, both this round and next round are set to plural
Iteration
Everytime we start a new round, we need to check if the current (and next) num
is plural or singular
Stop Cases
The while
loop will run until num = 0
. We have two special cases:
num === 1
: this round is singular, next round should beno bottles of juice
num === 0
: this round isno bottles of juice
, next round should finish the song withGo to the store and buy some more, 99 bottles of juice on the wall.
like the original song.
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
add a comment |
You missed some parenthesis
var bottles = 99; //You need to declare each var like this var x = "x"; var y = "y"
var bottle = "bottles"; // or you can declare it like this var x = "x", y ="y"
var text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}//Missed Parenthesis
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
}
bottles--;//The decreasment is always at the end
output.innerHTML += text;
}//Missed parenthesis
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
http://jsfiddle.net/1wg16qr5/49/
add a comment |
var num = 99;
var bottles = " bottles";
var bottlesWillChange = " bottles"
while (num > 0) {
if (num === 2) { bottlesWillChange = " bottle"; }
if (num === 1) { bottles = " bottle"; bottlesWillChange = " bottles"; }
console.log(num + bottles + " of juice on the wall! " + num + bottles + " of juice! Take one down, pass it around... " + (num - 1) + bottlesWillChange +" of juice on the wall!")
num--
}
Explanation: First we create 3 variables: num
, bottles
, bottlesWillChange
. In the second step we use a while loop with condition num > 0
. Main part: if num === 2, we change value bottlesWillChange to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1, we change first and second values of bottles variable to "bottle", because it's single and bottlesWillChange
variable value to "bottles".
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:num
,bottles
,bottlesWillChange
. In the second step we declarate while loop with conditionnum > 0
. Main part,if num === 2
, we change valuebottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num=== 1
, we change first and second values ofbottles
variable to "bottle", because it's single andbottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var
– Andrey Tsapko
Nov 26 '18 at 14:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25698940%2f99-bottle-of-beer-on-the-wall-code-not-working-pure-js-if-statement-and-while%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your code is full of errors.
To debug client-side code like JavaScript you may use the developer tools in Chrome/Firefox by pressing CTRL + SHIFT + i. It shows syntax errors like the one in the variable declaration part.
For further reading see the Chrome DevTools Overview. Chrome Dev tools are by far better than Firefox/IE/whatever (IMHO)
Here is the working code. Please compare by yourself.
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
add a comment |
Your code is full of errors.
To debug client-side code like JavaScript you may use the developer tools in Chrome/Firefox by pressing CTRL + SHIFT + i. It shows syntax errors like the one in the variable declaration part.
For further reading see the Chrome DevTools Overview. Chrome Dev tools are by far better than Firefox/IE/whatever (IMHO)
Here is the working code. Please compare by yourself.
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
add a comment |
Your code is full of errors.
To debug client-side code like JavaScript you may use the developer tools in Chrome/Firefox by pressing CTRL + SHIFT + i. It shows syntax errors like the one in the variable declaration part.
For further reading see the Chrome DevTools Overview. Chrome Dev tools are by far better than Firefox/IE/whatever (IMHO)
Here is the working code. Please compare by yourself.
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
Your code is full of errors.
To debug client-side code like JavaScript you may use the developer tools in Chrome/Firefox by pressing CTRL + SHIFT + i. It shows syntax errors like the one in the variable declaration part.
For further reading see the Chrome DevTools Overview. Chrome Dev tools are by far better than Firefox/IE/whatever (IMHO)
Here is the working code. Please compare by yourself.
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
var bottles = 99,
bottle = "bottles",
text = "",
output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}
text += bottles + " ";
text += bottle + " of beer on the wall, ";
text += bottles + " " + bottle + " of beer.<br>";
bottles--;
text += "Take one down and pass it around, ";
text += + bottles + " bottles of beer on the wall.<hr>"
if (bottles == 0) {
bottles = "no more";
}
output.innerHTML += text;
text = '';
}
output.innerHTML += " No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.";
<div style="text-align: center;">
<h1>99 Bottles of Beer Song</h1>
<div id="output"></div>
edited Dec 30 '16 at 16:26
answered Sep 6 '14 at 10:00
13872331387233
3,66383456
3,66383456
add a comment |
add a comment |
There are syntax errors - and logical errors:
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles >= 0) {
if (bottles == 1) {
bottle = "bottle";
}
// for all > 0
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles +
" " + bottle + " of beer. <br/>";
bottles--;
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " +
bottles + " bottles of beer on the wall. </p>"; // ; missing
} // } missing
output.innerHTML += text; // needs to be done always!
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
Fiddle here
2
bottles--;
needs to be moved out of theif
block
– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Moveif (bottles == 1){...}
beforetext = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes whenbottles
is 1. After the ifbottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.
– idmean
Sep 6 '14 at 9:58
|
show 2 more comments
There are syntax errors - and logical errors:
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles >= 0) {
if (bottles == 1) {
bottle = "bottle";
}
// for all > 0
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles +
" " + bottle + " of beer. <br/>";
bottles--;
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " +
bottles + " bottles of beer on the wall. </p>"; // ; missing
} // } missing
output.innerHTML += text; // needs to be done always!
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
Fiddle here
2
bottles--;
needs to be moved out of theif
block
– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Moveif (bottles == 1){...}
beforetext = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes whenbottles
is 1. After the ifbottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.
– idmean
Sep 6 '14 at 9:58
|
show 2 more comments
There are syntax errors - and logical errors:
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles >= 0) {
if (bottles == 1) {
bottle = "bottle";
}
// for all > 0
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles +
" " + bottle + " of beer. <br/>";
bottles--;
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " +
bottles + " bottles of beer on the wall. </p>"; // ; missing
} // } missing
output.innerHTML += text; // needs to be done always!
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
Fiddle here
There are syntax errors - and logical errors:
var bottles = 99
bottle = "bottles";
text = "";
var output = document.getElementById('output');
while (bottles >= 0) {
if (bottles == 1) {
bottle = "bottle";
}
// for all > 0
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles +
" " + bottle + " of beer. <br/>";
bottles--;
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " +
bottles + " bottles of beer on the wall. </p>"; // ; missing
} // } missing
output.innerHTML += text; // needs to be done always!
}
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
Fiddle here
edited Sep 6 '14 at 10:03
answered Sep 6 '14 at 9:49
Axel AmthorAxel Amthor
9,71411338
9,71411338
2
bottles--;
needs to be moved out of theif
block
– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Moveif (bottles == 1){...}
beforetext = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes whenbottles
is 1. After the ifbottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.
– idmean
Sep 6 '14 at 9:58
|
show 2 more comments
2
bottles--;
needs to be moved out of theif
block
– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Moveif (bottles == 1){...}
beforetext = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes whenbottles
is 1. After the ifbottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.
– idmean
Sep 6 '14 at 9:58
2
2
bottles--;
needs to be moved out of the if
block– Cubed Eye
Sep 6 '14 at 9:52
bottles--;
needs to be moved out of the if
block– Cubed Eye
Sep 6 '14 at 9:52
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
@CubedEye missed that one, thanks.
– Axel Amthor
Sep 6 '14 at 9:54
bottle
is being defined after it's used. Move if (bottles == 1){...}
before text = ...
– idmean
Sep 6 '14 at 9:55
bottle
is being defined after it's used. Move if (bottles == 1){...}
before text = ...
– idmean
Sep 6 '14 at 9:55
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@wumm No. Its define before the loop.
– Axel Amthor
Sep 6 '14 at 9:57
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes when
bottles
is 1. After the if bottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.– idmean
Sep 6 '14 at 9:58
@AxelAmthor Yes, that's correct. But what's the purpose of that if this way? The variable will never be used again after it's set in this if. The if executes when
bottles
is 1. After the if bottles
is decremented to 0. The while loop is no longer executed the variable isn't getting used.– idmean
Sep 6 '14 at 9:58
|
show 2 more comments
Starting Condition
- We start with 99 bottles
- Since both 99 and 98 are plural, both this round and next round are set to plural
Iteration
Everytime we start a new round, we need to check if the current (and next) num
is plural or singular
Stop Cases
The while
loop will run until num = 0
. We have two special cases:
num === 1
: this round is singular, next round should beno bottles of juice
num === 0
: this round isno bottles of juice
, next round should finish the song withGo to the store and buy some more, 99 bottles of juice on the wall.
like the original song.
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
add a comment |
Starting Condition
- We start with 99 bottles
- Since both 99 and 98 are plural, both this round and next round are set to plural
Iteration
Everytime we start a new round, we need to check if the current (and next) num
is plural or singular
Stop Cases
The while
loop will run until num = 0
. We have two special cases:
num === 1
: this round is singular, next round should beno bottles of juice
num === 0
: this round isno bottles of juice
, next round should finish the song withGo to the store and buy some more, 99 bottles of juice on the wall.
like the original song.
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
add a comment |
Starting Condition
- We start with 99 bottles
- Since both 99 and 98 are plural, both this round and next round are set to plural
Iteration
Everytime we start a new round, we need to check if the current (and next) num
is plural or singular
Stop Cases
The while
loop will run until num = 0
. We have two special cases:
num === 1
: this round is singular, next round should beno bottles of juice
num === 0
: this round isno bottles of juice
, next round should finish the song withGo to the store and buy some more, 99 bottles of juice on the wall.
like the original song.
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
Starting Condition
- We start with 99 bottles
- Since both 99 and 98 are plural, both this round and next round are set to plural
Iteration
Everytime we start a new round, we need to check if the current (and next) num
is plural or singular
Stop Cases
The while
loop will run until num = 0
. We have two special cases:
num === 1
: this round is singular, next round should beno bottles of juice
num === 0
: this round isno bottles of juice
, next round should finish the song withGo to the store and buy some more, 99 bottles of juice on the wall.
like the original song.
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
singBottles(15, 'juice');
function singBottles(givenNum, drinkType) {
let num = givenNum;
while (num >= 0) {
const bottlesFirstLine = num === 0 ?
`no more bottles` :
`${ num } ${ getPluralState(num) }`;
const bottlesSecondLine = num - 1 > 0 ?
`${ num - 1 } ${ getPluralState(num - 1) }` :
`no more bottles`;
const firstLine = `${ bottlesFirstLine } of ${ drinkType } on the wall! ${ bottlesFirstLine } of ${ drinkType }!`;
const secondLine = num - 1 >= 0 ? `Take one down, pass it around... ${ bottlesSecondLine } of ${ drinkType } on the wall!` :
`Go to the store and buy some more, ${ givenNum } ${ getPluralState(givenNum) } of ${ drinkType } on the wall.`;
console.log(`${ firstLine }n${ secondLine }n`);
num--;
}
}
function getPluralState(num) {
return num === 1 ? 'bottle' : 'bottles';
}
edited Nov 27 '18 at 11:29
answered Nov 26 '18 at 17:20
ThatkookooguyThatkookooguy
2,0551732
2,0551732
add a comment |
add a comment |
You missed some parenthesis
var bottles = 99; //You need to declare each var like this var x = "x"; var y = "y"
var bottle = "bottles"; // or you can declare it like this var x = "x", y ="y"
var text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}//Missed Parenthesis
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
}
bottles--;//The decreasment is always at the end
output.innerHTML += text;
}//Missed parenthesis
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
http://jsfiddle.net/1wg16qr5/49/
add a comment |
You missed some parenthesis
var bottles = 99; //You need to declare each var like this var x = "x"; var y = "y"
var bottle = "bottles"; // or you can declare it like this var x = "x", y ="y"
var text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}//Missed Parenthesis
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
}
bottles--;//The decreasment is always at the end
output.innerHTML += text;
}//Missed parenthesis
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
http://jsfiddle.net/1wg16qr5/49/
add a comment |
You missed some parenthesis
var bottles = 99; //You need to declare each var like this var x = "x"; var y = "y"
var bottle = "bottles"; // or you can declare it like this var x = "x", y ="y"
var text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}//Missed Parenthesis
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
}
bottles--;//The decreasment is always at the end
output.innerHTML += text;
}//Missed parenthesis
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
http://jsfiddle.net/1wg16qr5/49/
You missed some parenthesis
var bottles = 99; //You need to declare each var like this var x = "x"; var y = "y"
var bottle = "bottles"; // or you can declare it like this var x = "x", y ="y"
var text = "";
var output = document.getElementById('output');
while (bottles > 0) {
if (bottles == 1) {
bottle = "bottle";
}//Missed Parenthesis
text = "<p>" + bottles + " " + bottle + " of beer on the wall, " + bottles + " " + bottle + " of beer. <br/>";
if (bottles == 0) {
bottles = "no more";
text += "Take one down and pass it around, " + bottles + " bottles of beer on the wall. </p>"
}
bottles--;//The decreasment is always at the end
output.innerHTML += text;
}//Missed parenthesis
output.innerHTML += "<p> No more bottles of beer on the wall, no more bottles of beer. <br/> Go to the store and buy some more, 99 bottles of beer on the wall.</p>"
http://jsfiddle.net/1wg16qr5/49/
answered Sep 6 '14 at 10:05
Matteo CardelliniMatteo Cardellini
20621237
20621237
add a comment |
add a comment |
var num = 99;
var bottles = " bottles";
var bottlesWillChange = " bottles"
while (num > 0) {
if (num === 2) { bottlesWillChange = " bottle"; }
if (num === 1) { bottles = " bottle"; bottlesWillChange = " bottles"; }
console.log(num + bottles + " of juice on the wall! " + num + bottles + " of juice! Take one down, pass it around... " + (num - 1) + bottlesWillChange +" of juice on the wall!")
num--
}
Explanation: First we create 3 variables: num
, bottles
, bottlesWillChange
. In the second step we use a while loop with condition num > 0
. Main part: if num === 2, we change value bottlesWillChange to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1, we change first and second values of bottles variable to "bottle", because it's single and bottlesWillChange
variable value to "bottles".
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:num
,bottles
,bottlesWillChange
. In the second step we declarate while loop with conditionnum > 0
. Main part,if num === 2
, we change valuebottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num=== 1
, we change first and second values ofbottles
variable to "bottle", because it's single andbottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var
– Andrey Tsapko
Nov 26 '18 at 14:23
add a comment |
var num = 99;
var bottles = " bottles";
var bottlesWillChange = " bottles"
while (num > 0) {
if (num === 2) { bottlesWillChange = " bottle"; }
if (num === 1) { bottles = " bottle"; bottlesWillChange = " bottles"; }
console.log(num + bottles + " of juice on the wall! " + num + bottles + " of juice! Take one down, pass it around... " + (num - 1) + bottlesWillChange +" of juice on the wall!")
num--
}
Explanation: First we create 3 variables: num
, bottles
, bottlesWillChange
. In the second step we use a while loop with condition num > 0
. Main part: if num === 2, we change value bottlesWillChange to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1, we change first and second values of bottles variable to "bottle", because it's single and bottlesWillChange
variable value to "bottles".
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:num
,bottles
,bottlesWillChange
. In the second step we declarate while loop with conditionnum > 0
. Main part,if num === 2
, we change valuebottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num=== 1
, we change first and second values ofbottles
variable to "bottle", because it's single andbottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var
– Andrey Tsapko
Nov 26 '18 at 14:23
add a comment |
var num = 99;
var bottles = " bottles";
var bottlesWillChange = " bottles"
while (num > 0) {
if (num === 2) { bottlesWillChange = " bottle"; }
if (num === 1) { bottles = " bottle"; bottlesWillChange = " bottles"; }
console.log(num + bottles + " of juice on the wall! " + num + bottles + " of juice! Take one down, pass it around... " + (num - 1) + bottlesWillChange +" of juice on the wall!")
num--
}
Explanation: First we create 3 variables: num
, bottles
, bottlesWillChange
. In the second step we use a while loop with condition num > 0
. Main part: if num === 2, we change value bottlesWillChange to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1, we change first and second values of bottles variable to "bottle", because it's single and bottlesWillChange
variable value to "bottles".
var num = 99;
var bottles = " bottles";
var bottlesWillChange = " bottles"
while (num > 0) {
if (num === 2) { bottlesWillChange = " bottle"; }
if (num === 1) { bottles = " bottle"; bottlesWillChange = " bottles"; }
console.log(num + bottles + " of juice on the wall! " + num + bottles + " of juice! Take one down, pass it around... " + (num - 1) + bottlesWillChange +" of juice on the wall!")
num--
}
Explanation: First we create 3 variables: num
, bottles
, bottlesWillChange
. In the second step we use a while loop with condition num > 0
. Main part: if num === 2, we change value bottlesWillChange to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1, we change first and second values of bottles variable to "bottle", because it's single and bottlesWillChange
variable value to "bottles".
edited Nov 26 '18 at 17:46
Xcoder
1,01621124
1,01621124
answered Nov 24 '18 at 23:37
Andrey TsapkoAndrey Tsapko
114
114
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:num
,bottles
,bottlesWillChange
. In the second step we declarate while loop with conditionnum > 0
. Main part,if num === 2
, we change valuebottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num=== 1
, we change first and second values ofbottles
variable to "bottle", because it's single andbottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var
– Andrey Tsapko
Nov 26 '18 at 14:23
add a comment |
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:num
,bottles
,bottlesWillChange
. In the second step we declarate while loop with conditionnum > 0
. Main part,if num === 2
, we change valuebottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num=== 1
, we change first and second values ofbottles
variable to "bottle", because it's single andbottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var
– Andrey Tsapko
Nov 26 '18 at 14:23
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
Please explain the code(how it works).
– Xcoder
Nov 24 '18 at 23:58
@Xcoder, look, first we create 3 variables:
num
, bottles
, bottlesWillChange
. In the second step we declarate while loop with condition num > 0
. Main part, if num === 2
, we change value bottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1
, we change first and second values of bottles
variable to "bottle", because it's single and bottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var– Andrey Tsapko
Nov 26 '18 at 14:23
@Xcoder, look, first we create 3 variables:
num
, bottles
, bottlesWillChange
. In the second step we declarate while loop with condition num > 0
. Main part, if num === 2
, we change value bottlesWillChange
to "bottle", because in a part of our song when bottles equal 2, in last part of this string we should use "bottle". Next if statement work only if, our num === 1
, we change first and second values of bottles
variable to "bottle", because it's single and bottlesWiillchange
variable value to "bottles". I hope it's clear. when whe need change var– Andrey Tsapko
Nov 26 '18 at 14:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25698940%2f99-bottle-of-beer-on-the-wall-code-not-working-pure-js-if-statement-and-while%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you provide a jsfiddle?
– 1387233
Sep 6 '14 at 9:45
i just did sorry
– Matthew
Sep 6 '14 at 9:46
Where to start?..... There is no event starting your app. Syntax errors in your variable declaration ...
– 1387233
Sep 6 '14 at 9:49
how can i fix them
– Matthew
Sep 6 '14 at 9:51