get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
${"#target4"}.html("")
});
</script>
<!-- Only change code above this line. -->
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
$("#target4").html("<em>#target4</em>");
rtrtrtrtrtrtrtrtrtrtrtrtg sends brownie points to @girzima :sparkles: :thumbsup: :sparkles:
:cookie: 167 | @girzima |http://www.freecodecamp.com/girzima
<style>
.red-text {
color: red;
}
<p> .font-size: 16px;
</p>
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p> Purr jump eat the grass rip the couch scratched </p>
j-omar89 sends brownie points to @jordanppowell and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 264 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
:cookie: 511 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target1").prop("disabled", true);
$("#target4").remove();
$("#target2").appendTo("#right-well");
$("#target5").clone("#target5").appendTo("left-well");
});
</script>
<style>
body {
background-color: #000000;
}
</style>
anukath sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 343 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
janesuit sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
<div class="container-fluid">
<!-- ALL other code here -->
</div>
leslieshort sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 345 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
gloriious sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
sid-kul sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
<label><input type="radio" name="indoor-outdoor">Indoor</label>
<label><input type="radio" name="inoor-outdoor">Outdoor</label>
git -it verify
?
$(document).ready(function() {
$("#target1").css("color", "red");
$("target4").html("<em>target4</em>")
});
im supposed to emphasize the text in my target4 button but i can't get it to select button id="target4"
#
's
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target4").html("<em>target4</em>")
});
#
indicates to JQuery that you are referencing an id.
datoufa sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target4").html("<em>#target4</em>")
});
</script>
<!-- Only change code above this line. -->
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target4").html("<em>#target4</em>";
});
</script>
myth-fyre sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
@iJoshmo Color your h3 element with the text-primary Bootstrap class, and center it with the text-center Bootstrap class.
Which means you don't need the div. The classes should go right to your h3
<style>
.red-text {
color: red;
}
p {
font-size=16px;
}
p
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Kitty ipsum Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<style>
.red-text {
color: red;
}
p {
font-size:16px;
}
</style>
Delete the p and change the =
to a :
font-size: 16px;
You have an equals, it's a colon
sorry jadefox10200, you can't send brownie points to yourself! :sparkles: :sparkles:
jordanppowell sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
maseeh121 sends brownie points to @jadefox10200 and @jordanppowell and @lpr-309 :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
:cookie: 300 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
:cookie: 370 | @lpr-309 |http://www.freecodecamp.com/lpr-309
jordanppowell sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 1126 | @lydatech |http://www.freecodecamp.com/lydatech
<input class="form-control" type="text" placeholder="cat photo URL" required>
noahlievable sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
jadefox10200 sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 1127 | @lydatech |http://www.freecodecamp.com/lydatech
gizzly sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 1128 | @lydatech |http://www.freecodecamp.com/lydatech
display: block;
gizzly sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:warning: gizzly already gave lydatech points
<!-- this is a comment -in HTML-->
<div class="container-fluid">
... your html
</div>
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<div class="container-fluid"></div>
<h2 class="red-text">CatPhotoApp</h2>
<p>Click here for <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
<div class="container-fluid"></div>
you need the ending </div>
at the bottom of the html not right next to the <div class="container-fluid">
noahlievable sends brownie points to @ionutlenuta :sparkles: :thumbsup: :sparkles:
:cookie: 404 | @ionutlenuta |http://www.freecodecamp.com/ionutlenuta
function pre(e){ e.preventDefault(); }//why i change to event, it will work perfectly to prevent after press enter all search results disappear;
function loadData() {
var wikiUrl="https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=extracts&exintro&explaintext&exsentences=1&exlimit=max&callback=?&gsrsearch="
var value=$("input").val();
$.getJSON(wikiUrl+value, function(data) {
var obj=data.query.pages;
var HTMLnodes = "";
// build up the results
$.map(obj,function(v,i){
HTMLnodes += "<div id='wikiDiv'><a href='https://en.wikipedia.org/wiki/"
+v.title+"' target='_blank'><h2 id='wikiTitle'>"+v.title+
"</h2>"+"</a><h4 id='wikiExtract'>"
+v.extract+"</h4></div>"
});
//remove old search results
$("#wikiContent").empty();
//add new results
$("#wikiContent").append(HTMLnodes);
});
pre(e);//why i change to event, it will work perfectly to prevent after press enter all search results disappear;
}
the above questions is for this code: http://codepen.io/c0d0er/pen/WGkQvk?editors=1010pre(e);//why i change to event, it will work perfectly to prevent after press enter all search results disappear?
, function pre(e){ e.preventDefault(); }//why i change to event, it will work perfectly to prevent after press enter all search results disappear?
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<div class="container-fluid">
...html
</div>
<h2 class="red-text">CatPhotoApp</h2>
<p>Click here for <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
function pre(e){ e.preventDefault(); }//why i change to event, it will work perfectly to prevent after press enter all search results disappear;
function loadData() {
var wikiUrl="https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=extracts&exintro&explaintext&exsentences=1&exlimit=max&callback=?&gsrsearch="
var value=$("input").val();
$.getJSON(wikiUrl+value, function(data) {
var obj=data.query.pages;
var HTMLnodes = "";
// build up the results
$.map(obj,function(v,i){
HTMLnodes += "<div id='wikiDiv'><a href='https://en.wikipedia.org/wiki/"
+v.title+"' target='_blank'><h2 id='wikiTitle'>"+v.title+
"</h2>"+"</a><h4 id='wikiExtract'>"
+v.extract+"</h4></div>"
});
//remove old search results
$("#wikiContent").empty();
//add new results
$("#wikiContent").append(HTMLnodes);
});
pre(e);//why i change to event, it will work perfectly to prevent after press enter all search results disappear;
}
the above questions is for this code: http://codepen.io/c0d0er/pen/WGkQvk?editors=1010pre(e);//why i change to event, it will work perfectly to prevent after press enter all search results disappear?
, function pre(e){ e.preventDefault(); }//why i change to event, it will work perfectly to prevent after press enter all search results disappear?
Hey guys does anyone know on how to make a img element to have the class smaller-image with 100 pixels. This is what I have. <img class="smaller-image"
<style>.smaller-image {width:100px;}</style>
abhinay141 sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
mosem24 sends brownie points to @jordanppowell and @zheria :sparkles: :thumbsup: :sparkles:
:cookie: 46 | @zheria |http://www.freecodecamp.com/zheria
:cookie: 305 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
dadenb sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 306 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
dadenb sends brownie points to @zheria :sparkles: :thumbsup: :sparkles:
:cookie: 48 | @zheria |http://www.freecodecamp.com/zheria
:
and you'll see
@jadefox10200 @JordanPPowell function golfScore(par, strokes) {
// Only change code below this line
if (4 == 1){
return "Hole-in-one!";
}
// Only change code above this line
}
// Change these values to test
golfScore(5, 4);
if (4 == 1){
color
not colour
if (strokes == 1){
backchristoffer sends brownie points to @jadefox10200 and @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 351 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
:cookie: 307 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
turnSeq.push(panelId); //array ispopulated by id of panel pressed
if (turnSeq.length <=1 || turnSeq.length > pSeq.length) { //Pushes only new moves into playerSeq Array after 1 move has been made.
var removed=turnSeq.splice(10,1); //get only the last move of the turn into player array as the SIMON game only goes up 1 move per turn
pSeq.push(removed); //push that move into player array...
};
This gives the value array[0] whjen i add it to pSeq... How come?
turnSeq[turnSeq.length-1];
123xylem sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 352 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
${document}.ready(function(){};)
what does it mean?
{}
once the entire HTML document has been loaded.
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div> <div class="col-xs-6"> </div> <div class="well">
</div> </div>
<div> <div class="col-xs-6"> </div> <div class="well"> </div>
</div>
</div>
</div>
<div class="well">
inside <div class="col-xs-6"> </div>
waytogn sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 754 | @sorinr |http://www.freecodecamp.com/sorinr
==
as that's checking loosly.
===
checks both value and type.
@123xylem
function correct() {
if (cSeq.length == pSeq.length) {// If player turn array has same turns as cpu
for (i = cSeq.length; i >= 0; i--) { //go through the turnsstarting from the last and count down through them both
console.log("what correct sees", cSeq[i], pSeq[i]); //THESE ELEMENTS COME BACK AS UNDEFINED!!!
if (cSeq[i] != pSeq[i]) { //IF they dont match play wrong sound
audioF['wrong'].play();
wasWrong = 0;
console.log("wrong", cSeq, pSeq[i], pSeq);
pSeq = [];
// setInterval(lastSeq(), 8000); // Say wrong and replay last seq
// cpuTurn = 0;
} else {
//DO SOMETHING else(never gets here)
} } } }
Question: why is pSeq cSeq[i] undefined in console?
$(".panel").on("click", function() {
cpuTurn = 1;
var panelId = $(this).attr("id");
audioF[panelId.toLowerCase()].play(); //use id as soundfile
$("#" + panelId).toggleClass('animate');
//HOW DO i get this to activate and go back to default onclick?
turnSeq.push(panelId);
if (turnSeq.length <= 1 || turnSeq.length > pSeq.length) {
var removed = turnSeq.splice(10, 1);
pSeq.push(turnSeq[turnSeq.length - 1]);
}; //Pushes only new moves into pSeq
They get their elements from the ID of the button hit
or panel hit
function golfScore(par, strokes) {
// Only change code below this line
if (strokes == 1){
return "Hole-in-one!";
} else if (strokes <= par){
return "Eagle";
} else if (strokes == par-1){
return "Birdie";
}
// Only change code above this line
}
// Change these values to test
golfScore(5, 4);
==
only checks value. So "5" and 5 are equal using the ==
but are not equal when using ===
as one is a string and the other is an int.
} else if (strokes <= par){
return "Eagle";
<div class="col-xs-6">
<div class='well'></div>
</div>
backchristoffer sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:warning: backchristoffer already gave jadefox10200 points
geolocation
```<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<div class="well"></div>
</div>
<div class="col-xs-6">
<div class="well"></div>
</div>
</div>
</div>```
websect sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 309 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
amitp88 sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 353 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
krisalaine sends brownie points to @theharshitgarg :sparkles: :thumbsup: :sparkles:
:cookie: 561 | @theharshitgarg |http://www.freecodecamp.com/theharshitgarg
krisalaine sends brownie points to @blnt :sparkles: :thumbsup: :sparkles:
:cookie: 170 | @blnt |http://www.freecodecamp.com/blnt
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
h2 {
font-family: Lobster, Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
</style>
<div class="container-fluid">
<div class="row">
<div class="col-xs-8">
<h2 class="text-primary text-center">CatPhotoApp</h2>
</div>
<div class="col-xs-4">
<a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. "></a>
</div>
</div>
<img src="https://bit.ly/fcc-running-cats" class="img-responsive" alt="Three kittens running towards the camera. ">
<div class="row">
<div class="col-xs-4">
<button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button>
</div>
<div class="col-xs-4">
<button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button>
</div>
<div class="col-xs-4">
<button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button>
</div>
</div>
<p>Things cats <span class="text-danger">love:</span></p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<div class="row">
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
</div>
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
</div>
<div class="row">
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Loving</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Lazy</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Crazy</label>
</div>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>
mosem24 sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
amitp88 sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave jadefox10200 points
amitp88 sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave jadefox10200 points
<div class="row">
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Loving</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Lazy</label>
</div>
amitp88 sends brownie points to @darrenfj and @jadefox10200 :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave jadefox10200 points
:cookie: 871 | @darrenfj |http://www.freecodecamp.com/darrenfj
amitp88 sends brownie points to @blnt :sparkles: :thumbsup: :sparkles:
:cookie: 171 | @blnt |http://www.freecodecamp.com/blnt
>
chrisddoug sends brownie points to @jordanppowell :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
ponking sends brownie points to @theharshitgarg and @jordanppowell and @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @jordanppowell |http://www.freecodecamp.com/jordanppowell
:cookie: 562 | @theharshitgarg |http://www.freecodecamp.com/theharshitgarg
:cookie: 354 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
even me @mosem24
sorry jadefox10200, you can't send brownie points to yourself! :sparkles: :sparkles:
jadefox10200 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:cookie: 872 | @darrenfj |http://www.freecodecamp.com/darrenfj
darrenfj sends brownie points to @jadefox10200 :sparkles: :thumbsup: :sparkles:
:cookie: 355 | @jadefox10200 |http://www.freecodecamp.com/jadefox10200
mosem24 sends brownie points to @websect and @jordanppowell :sparkles: :thumbsup: :sparkles:
:warning: mosem24 already gave jordanppowell points
:cookie: 5 | @websect |http://www.freecodecamp.com/websect
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount:0
},
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 quantity); break;
case "milk": this.add(1.23 quantity); break;
case "magazine": this.add(4.99 quantity); break;
case "chocolate": this.add(0.45 quantity); break;
}
return true;
},
voidLastTransaction:function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
applyStaffDiscount: function(employee){
this.total -= this.total * (1-employee.discountPercent/100);
}
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister. applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
This repo serves as an archive for the wiki and a place to report issues for our current wiki located in our forum!
Our open source community's Wiki focuses on answering your questions about learning to code and getting a coding job. We also cover in detail our:
- Curriculum
- Other Programming Languages
- Local Group Communities
- Nonprofit Projects and much more
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount:0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
return true;
},
voidLastTransaction:function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
applyStaffDiscount: function(employee){
this.total -= this.total * (1-employee.discountPercent/100);
}
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister. applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
},
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
},
oh shit
christopher-siewert sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:cookie: 384 | @r1chard5mith |http://www.freecodecamp.com/r1chard5mith
new code please help function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount: 0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
applyStaffDiscount: function(employee){
this.total -= this.total * (1-employee.discountPercent/100);
},
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
return true;
},
voidLastTransaction : function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister. applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount: 0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
applyStaffDiscount: function(employee){
this.total -= this.total * (1-employee.discountPercent/100);
},
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
return true;
},
voidLastTransaction : function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister. applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
Can some help me out with showing me how to add an id of target 1, target 2 and target 3 to these three buttons?
<div class="well" id="left-well">
<button class="btn btn-default target"></button>
<button class="btn btn-default target"></button>
<button class="btn btn-default target"></button>
</div>
jordskimol sends brownie points to @ionutlenuta and @freshcapsule :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for freshcapsule
:cookie: 405 | @ionutlenuta |http://www.freecodecamp.com/ionutlenuta
```
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount:0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
return true;
},
voidLastTransaction:function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
applyStaffDiscount: function(employee){
this.total -= this.total * (1-employee.discountPercent/100);
}
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister. applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
```
:cookie: 386 | @r1chard5mith |http://www.freecodecamp.com/r1chard5mith
malobeid sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
nenyeboy sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @r1chard5mith |http://www.freecodecamp.com/r1chard5mith
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount:0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 quantity); break;
case "milk": this.add(1.23 quantity); break;
case "magazine": this.add(4.99 quantity); break;
case "chocolate": this.add(0.45 quantity); break;
}
return true;
},
voidLastTransaction:function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
applyStaffDiscount: function(employee){
this.total += this.total * (1-employee.discountPercent/100);
}
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister.applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<5; i++){
if (contacts[i][firstName] == firstName && contacts[i].OwnProperty(prop) == prop){
return contacts[i][prop];
}
}
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
freshcapsule sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:cookie: 388 | @r1chard5mith |http://www.freecodecamp.com/r1chard5mith
function StaffMember(name,discountPercent){
this.name = name;
this.discountPercent = discountPercent;
}
var sally = new StaffMember("Sally",5);
var bob = new StaffMember("Bob",10);
// Create yourself again as 'me' with a staff discount of 20%
var me = new StaffMember("Mustafa",20);
var cashRegister = {
total:0,
lastTransactionAmount:0,
add: function(itemCost){
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
},
scan: function(item,quantity){
switch (item){
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
return true;
},
voidLastTransaction:function(){
this.total -= this.lastTransactionAmount;
this.lastTransactionAmount = 0;
},
// Create a new method applyStaffDiscount here
applyStaffDiscount: function(employee){
this.total += this.total * (1-employee.discountPercent/100);
}
};
cashRegister.scan('eggs',1);
cashRegister.scan('milk',1);
cashRegister.scan('magazine',3);
// Apply your staff discount by passing the 'me' object
// to applyStaffDiscount
cashRegister.applyStaffDiscount(me);
// Show the total bill
console.log('Your bill is '+cashRegister.total.toFixed(2));
malobeid sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:warning: malobeid already gave r1chard5mith points
r1chard5mith sends brownie points to @freshcapsule :sparkles: :thumbsup: :sparkles:
:cookie: 181 | @freshcapsule |http://www.freecodecamp.com/freshcapsule
r1chard5mith sends brownie points to @malobeid :sparkles: :thumbsup: :sparkles:
:cookie: 11 | @malobeid |http://www.freecodecamp.com/malobeid
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<5; i++){
return contacts[1];
}
freshcapsule sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:warning: freshcapsule already gave r1chard5mith points
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p>Click here for <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo" type="text/form" placeholder="cat- photo-URL" ></form>
what is wrong with my form element
$("#target5").clone().appendTo("#left-well");
:bulb: to format code use backticks! ``` more info
<input
@nenyeboy
<button class="btn btn-block btn-primary">Like</button>
if I understand your question @kryptonian41
<style>
.red-text{
color:red;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
mohit1998 sends brownie points to @arlworker :sparkles: :thumbsup: :sparkles:
:cookie: 9 | @arlworker |http://www.freecodecamp.com/arlworker
@ionutlenuta
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p>Click here for <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo" <input type="text/form" placeholder="cat- photo-URL" ></form>
/form
@nenyeboy
type="text/form"
@nenyeboy
nenyeboy sends brownie points to @ionutlenuta and @r1chard5mith :sparkles: :thumbsup: :sparkles:
:warning: nenyeboy already gave r1chard5mith points
:cookie: 406 | @ionutlenuta |http://www.freecodecamp.com/ionutlenuta