get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
var min = 0;
var max = 9;
function myFunction() {
// Make myFunction return a random number between min and max values instead of a decimal
// Only change code below this line.
return Math.random();
Math.floor(Math.random()10);
Math.floor(Math.random() (max - min + 1)) + min;
}
// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
I think you need to combine the lines. Also you don't need the 10 in there.
return Math.floor(Math.random() * (max - min + 1)) + min;
judes3011 sends brownie points to @chrisisacrook and @jeanneericksoncooley :sparkles: :thumbsup: :sparkles:
:star: 223 | @jeanneericksoncooley | http://www.freecodecamp.com/jeanneericksoncooley
:star: 165 | @chrisisacrook | http://www.freecodecamp.com/chrisisacrook
Do you want the whole code? it is ..*<link href="http://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">
<h2 class="red-text text-center">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"></a>
<img src="http://bit.ly/fcc-running-cats" class="img-responsive" class1="btn">Like
<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>..*
<button type="" class="">Text</button>
@lauralstephenson its a new element, so don't place it inside the <img tag> declare it separately
<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<button> </button>
then apply the class .btn to it. and add the text "Like"
lauralstephenson sends brownie points to @veeshostak and @chrisisacrook :sparkles: :thumbsup: :sparkles:
:star: 204 | @veeshostak | http://www.freecodecamp.com/veeshostak
:star: 169 | @chrisisacrook | http://www.freecodecamp.com/chrisisacrook
<p>View more <a href="http://www.freecatphotoapp.com">cat photos </a></p>
edwardudelle sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1178 | @saintpeter | http://www.freecodecamp.com/saintpeter
trishsnyder sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1179 | @saintpeter | http://www.freecodecamp.com/saintpeter
jauble sends brownie points to @jordanbourne and @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 386 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
:star: 253 | @jordanbourne | http://www.freecodecamp.com/jordanbourne
Boot camp 84, can't seem to: Each of your Bootstrap buttons should be nested within its own div element with the class col-xs-4. Here is my code:..*<link href="http://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;
}
.row
.col-xs-4
</style>
<div class="container-fluid">
<h2 class="red-text text-center">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"></a>
<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<div class="row">
<button class="btn btn-block btn-primary" "col-xs-4">Like</button>
</div>
<div class="row">
<button class="btn btn-block btn-info" "col-xs-4">Info</button>
</div>
<div class="row">
<button class="btn btn-block btn-danger" "col-xs-4">Delete</button>
</div> ..*
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car()
//Add the property "engines" to myCar, and make it a number.
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car()
this.engines = 1;
//Add the property "engines" to myCar, and make it a number.
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car()
this.engines = 1;
//Add the property "engines" to myCar, and make it a number.
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
this
is a tricky thing to understand, but in your code it is referring to the global object. Just refernce your obect like this myCar.engine = 1
randytorres sends brownie points to @mattyamamoto and @marcusp619 :sparkles: :thumbsup: :sparkles:
:star: 387 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
:star: 273 | @marcusp619 | http://www.freecodecamp.com/marcusp619
co6alt sends brownie points to @mattyamamoto and @randytorres :sparkles: :thumbsup: :sparkles:
:star: 388 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
:star: 173 | @randytorres | http://www.freecodecamp.com/randytorres
this
keyword, but I think it's more complicated than just scope.
Boot camp 84, can't seem to: Each of your Bootstrap buttons should be nested within its own div element with the class col-xs-4. Here is my code:..*<link href="http://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;
}
.row
.col-xs-4
</style>
<div class="container-fluid">
<h2 class="red-text text-center">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"></a>
<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<div class="row">
<button class="btn btn-block btn-primary" "col-xs-4">Like</button>
</div>
<div class="row">
<button class="btn btn-block btn-info" "col-xs-4">Info</button>
</div>
<div class="row">
<button class="btn btn-block btn-danger" "col-xs-4">Delete</button>
</div> ..*
this
only binds to a different object when used inside another object. At least that's my understanding.
this
often sounds funny. But what you describe is the scope chain, but that's different, isn't it?
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
``` ⇦ Type 3 backticks and then press [shift + enter ⏎]
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
function b() {
console.log(myVar);
}
function a() {
var myVar = 2;
b();
}
var myVar = 1;
a();
console.log(this)
inside either function and you'll get the global object.
<link href="http://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;
}
.row
.col-xs-*
</style>
<div class="container-fluid">
<h2 class="red-text text-center">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"></a>
<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<div class=row col-xs-*>
<button class="btn btn-block btn-primary col-xs-4">Like</button></div>
<div class=row col-xs-*>
<button class="btn btn-block btn-info col-xs-4">Info</button></div>
<div class=row col-xs-*>
<button class="btn btn-block btn-danger col-xs-4">Delete</button>
</div>
<p>Things cats love:</p> \\
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
``` ⇦ Type 3 backticks and then press [shift + enter ⏎]
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
function reverseString(str) {
return str;
}
reverseString("hello").split("").reverse().join("");
with this reverse a string i thought this look right but it is not working function reversestringstr return strreversestringhellosplitreversejoin
update
to reload it here
@lauralstephenson in any event when you're asked to put something in a div, or to wrap something in a div you need to imagine this
<div>
...stuff in here
</div>
you need both the opening and closing tags to be around the content you are wrapping in the divs
.split("").reverse().join("")
needs to be in your reverseString
function.
str
.
[shift + enter ⏎]
col-xs-4
class on the buttons themselves, get rid of those
lauralstephenson sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 389 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
lauralstephenson sends brownie points to @takumab and @mattyamamoto :sparkles: :thumbsup: :sparkles:
:warning: lauralstephenson already gave mattyamamoto points
:star: 93 | @takumab | http://www.freecodecamp.com/takumab
class="one two etc"
<div class="class1 class2">
. You can add as many classes as you like, just seperate them with spaces
takumab sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 390 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
animated
and bounce
and see if that does the trick.
mrmgarcia sends brownie points to @matthew02 :sparkles: :thumbsup: :sparkles:
:star: 356 | @matthew02 | http://www.freecodecamp.com/matthew02
Help. I’m stuck still in the Bonfire: Palindrome
im stuck still in the bonfire palindrome
update
to reload it here
function palindrome(str) {
// Good luck!
var len = str.toLowerCase().length;
for ( var i = 0; i < Math.floor(len/2); i++ ) {
if (str[i] !== str[len - 1 - i]) {
return false;
}
}
return true;
}
psykobilliethekid sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 299 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
dantesolis sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 300 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
kasunw310 sends brownie points to @dantesolis :sparkles: :thumbsup: :sparkles:
:star: 186 | @dantesolis | http://www.freecodecamp.com/dantesolis
Hey Campers, Happy friday.
I was working on bonfire Smalles Common Multiple
and was just wanting a bit of direction i hope i got to the right place.
function smallestCommons(arr) {
var commonMultiple = 1;
while (commonMultiple % arr[0] !== 0 && commonMultiple%arr[1] !== 0){
commonMultiple++;
console.log(commonMultiple);
}
return commonMultiple;
}
console.log(smallestCommons([1,5]),
smallestCommons([5, 1]),
smallestCommons([1, 13]));
Why is my While loop not working?
(was the question i deleted)
function titleCase(str) {
str[0] = str[0].toUpperCase();
for(var i=0;i<str.length;i++){
if(str.charAt[i] ==" "){
str.charAt[i+1] = charAt[i+1].toUpperCase();
}
}
return str;
}
titleCase("I'm a little tea pot");
Sorry, can't find a bonfire called titlecase. [ Check the map? ]
function titleCase(str) {
return str;
}
titleCase("I'm a little tea pot");
Return the provided string with the first letter of each word capitalized.
more info:
bf details
|bf links
|hint
function titleCase(str) {
return str;
}
titleCase("I'm a little tea pot");
Return the provided string with the first letter of each word capitalized.:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
!==0
chasemthomas sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1451 | @dting | http://www.freecodecamp.com/dting
chasemthomas sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: chasemthomas already gave dting points
<style>
h2
.red-text {
color: red;
}
</style>
<h2>CatPhotoApp</h2>
what is wrong ?
<h2 class="some-class">CatPhotoApp</h2>
is how you apply .some-class to the <h2>
Math.max.apply(null,array)
?
Waypoint: Fill in the Blank with Placeholder Text
Web developers traditionally use lorem ipsum text as placeholder text. It's called lorem ipsum text because those are the first two words of a famous passage by Cicero of Ancient Rome.
lorem ipsum text has been used as placeholder text by typesetters since the 16th century, and this tradition continues on the web.
Well, 5 centuries is long enough. Since we're building a CatPhotoApp, let's use something called kitty ipsum text.
Replace the text inside your p element with the first few words of this kitty ipsum 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.
what to do here ?
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car();
this.engines = 2;
//Add the property "engines" to myCar, and make it a number.
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
myCar.color = "red"
;
mariashifa sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 303 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
<style>
h2
.red-text{
color: red;
}
</style>
<h2 class= "some-class">CatPhotoApp</h2>
<p>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>
mbansal11 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 304 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
<style>
.red-text {
color: red;
}
p {
font-size: 16px;
font-family: Monospace;
}
</style>
<h2 class="red-text" font-family: Lobster;>CatPhotoApp</h2>
mbansal11 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:warning: mbansal11 already gave h4r1m4u points
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
font-family: Lobster;
bit. in CSS, you don't use <!-- and --> to comment thing out
/*
and */
mbansal11 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:warning: mbansal11 already gave h4r1m4u points
mbansal11 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:warning: mbansal11 already gave h4r1m4u points
Hi guys
I passed all tests, only this
"Use the provided code three times. One for each slot."
Don't know why ? Is there anyone can help ? :)
$($('.slot')[0]).html('<img src = "'+ images[slotOne - 1] + '">');
$($('.slot')[1]).html('<img src = "'+ images[slotTwo - 1] + '">');
$($('.slot')[2]).html('<img src = "'+ images[slotThree - 1] + '">');
dungtm007 sends brownie points to @avishayshushan :sparkles: :thumbsup: :sparkles:
:star: 314 | @avishayshushan | http://www.freecodecamp.com/avishayshushan
´´<script>
function runSlots(){
var slotOne;
var slotTwo;
var slotThree;
var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];
// Only change code below this line.
{ slotOne
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
}
// Only change code above this line.
$(".logger").html("");
$(".logger").html("Not A Win")
if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
$(".logger").html(slotOne + " " + slotTwo + " " + slotThree);
}
return [slotOne, slotTwo, slotThree];
}
$(document).ready(function(){
$(".go").click(function(){
runSlots();
});
});
</script>
´´
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 5px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>View more <a href="http://www.freecatphotoapp.com">Cat Photos</a></p>
Hi, I'm CamperBot! I can help you in this chatroom :smile:
find TOPIC
find all entries about topic. ex: find js
wiki TOPIC
show contents of topic pagethanks @username
send brownie points to another userabout @username
shows info on that userbonfire BONFIRENAME
info on a bonfire:speech_balloon: meet CamperBot in this room!
find js
:zero: how jsonp is different from json
:one: js regex resources
:two: js resources
:three: zipline use the twitchtv json api
:four: js array prototype filter
:five: js array prototype indexof
:six: js array prototype map
:seven: js array prototype pop
:eight: js array prototype push
:nine: js array prototype shift
:one::zero: js array prototype some
:one::one: js array prototype tostring
:one::two: js boolean
:one::three: js string prototype split
:one::four: js string prototype tolowercase
:one::five: js string prototype touppercase
:one::six: js arguments
:one::seven: js closures
:one::eight: js falsy
:one::nine: js for in loop
limited to first 20 entries.
typefind js
again for more enteries.
@avishayshushan Waypoint: Create a JavaScript Slot Machine
We are now going to try and combine some of the stuff we've just learned and create the logic for a slot machine game.
For this we will need to generate three random numbers between 1 and 3 to represent the possible values of each individual slot.
Store the three random numbers in slotOne, slotTwo and slotThree.
Generate the random numbers by using the system we used earlier (an explanation of the formula can be found here):
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
´´<script>
function runSlots(){
var slotOne;
var slotTwo;
var slotThree;
var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];
// Only change code below this line.
function
{ slotOne
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree
return Math.random();
Math.floor(Math.random() * (3 - 1 + 1)) + 1;
}
// Only change code above this line.
$(".logger").html("");
$(".logger").html("Not A Win")
if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
$(".logger").html(slotOne + " " + slotTwo + " " + slotThree);
}
return [slotOne, slotTwo, slotThree];
}
$(document).ready(function(){
$(".go").click(function(){
runSlots();
});
});
</script>
<div>
<div class = "container inset">
<div class = "header inset">
<img src="https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz" alt="learn to code javascript at Free Code Camp logo" class="img-responsive nav-logo">
<h2>FCC Slot Machine</h2>
</div>
<div class = "slots inset">
<div class = "slot inset">
</div>
<div class = "slot inset">
</div>
<div class = "slot inset">
</div>
</div>
<br/>
<div class = "outset">
<button class = "go inset">
Go
</button>
</div>
<br/>
<div class = "foot inset">
<span class = "logger"></span>
</div>
</div>
</div>
<style>
.container {
background-color: #4a2b0f;
height: 400px;
width: 260px;
margin: 50px auto;
border-radius: 4px;
}
.header {
border: 2px solid #fff;
border-radius: 4px;
height: 55px;
margin: 14px auto;
background-color: #457f86
}
.header h2 {
height: 30px;
margin: auto;
}
.header h2 {
font-size: 14px;
margin: 0 0;
padding: 0;
color: #fff;
text-align: center;
}
.slots{
display: flex;
background-color: #457f86;
border-radius: 6px;
border: 2px solid #fff;
}
.slot{
flex: 1 0 auto;
background: white;
height: 75px;
margin: 8px;
border: 2px solid #215f1e;
border-radius: 4px;
}
.go {
width: 100%;
color: #fff;
background-color: #457f86;
border: 2px solid #fff;
border-radius: 2px;
box-sizing: none;
outline: none!important;
}
.foot {
height: 150px;
background-color: 457f86;
border: 2px solid #fff;
}
.logger {
color: white;
margin: 10px;
}
.outset {
-webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
}
.inset {
-webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
-moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
}
</style>´´
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
``` ⇦ Type 3 backticks and then press [shift + enter ⏎]
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
piaffe sends brownie points to @avishayshushan :sparkles: :thumbsup: :sparkles:
:star: 315 | @avishayshushan | http://www.freecodecamp.com/avishayshushan
backbenchernewbie sends brownie points to @piaffe :sparkles: :thumbsup: :sparkles:
:star: 159 | @piaffe | http://www.freecodecamp.com/piaffe
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
gear
1
addStyle
function do?
<link href="http://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>View more
<a href="http://www.freecatphotoapp.com">cat photos</a>
</p>
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
<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 class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
backbenchernewbie sends brownie points to @piaffe :sparkles: :thumbsup: :sparkles:
:warning: backbenchernewbie already gave piaffe points
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
``` ⇦ Type 3 backticks and then press [shift + enter ⏎]
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
fennekbe sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 282 | @coira | http://www.freecodecamp.com/coira
function reverseString(str) {
return str;
}
reverseString("hello");
var string = "hello";
var array = string.split('');
string.split("").reverse().join("");
reverseString("Howdy");
var string = "Howdy";
var array = string.split('');
string.split("").reverse().join("");
reverseString("Greetings from Earth");
var string = "Greetings from Earth";
var array = string.split('');
string.split("").reverse().join("");
teemiaster sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 408 | @camperbot | http://www.freecodecamp.com/camperbot
<p>some text</p>
. this is a paragraph with class 'red' and 'big': <p class="red big">some text</p>
vardan1992 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 305 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
I'm trying to reverse the string in bonfire. I'll paste my code below and it works, but I feel like it's not the proper way to do it.
'''
function reverseString(str) {
var i = 0;
var strReversed = "";
var strTemporary = "";
while (i < str.length){
strTemporary = str[str.length - i - 1];
strReversed += strTemporary;
i++;
}
return strReversed;
}
reverseString("hello");
'''
:bulb: to format code use backticks! ``` more info
function reverseString(str) {
var i = 0;
var strReversed = "";
var strTemporary = "";
while (i < str.length){
strTemporary = str[str.length - i - 1];
strReversed += strTemporary;
i++;
}
return strReversed;
}
reverseString("hello");
fennekbe sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 306 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
fennekbe sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1457 | @dting | http://www.freecodecamp.com/dting
justinian336 sends brownie points to @bomholt :sparkles: :thumbsup: :sparkles:
:star: 387 | @bomholt | http://www.freecodecamp.com/bomholt
bomholt sends brownie points to @cabra503 :sparkles: :thumbsup: :sparkles:
:star: 203 | @cabra503 | http://www.freecodecamp.com/cabra503
justinian336 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1459 | @dting | http://www.freecodecamp.com/dting
justinian336 sends brownie points to @bomholt :sparkles: :thumbsup: :sparkles:
:warning: justinian336 already gave bomholt points
Hi to all!
I have a question - where to place the class
.green-background {
background-color: green;
}
to assign this class to my div block
<div>
<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>
</div>
At the top of the html doc in style brackets. so
<style>
.green-background {
background-color: green;
}
</style>
here all the code:
<link href="http://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;
}
.grey-background {
background-color: grey;
}
</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" src="https://bit.ly/fcc-relaxing-cat"></a>
<div class=grey-background>
<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>
</div>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
<link href="http://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;
}
.gray-background {
background-color: gray;
}
</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" src="https://bit.ly/fcc-relaxing-cat"></a>
<div class="gray-background">
<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>
</div>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
<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> class="red-text">kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car();
//Add the property "engines" to myCar, and make it a number.
myCar.engines = 2;
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
find smallest common multiple
function destroyer(arr) {
console.log(arguments);
var a = arr;
for (var i = 1; i < arguments.length; i++) {
a.filter(function(el, index, array){
console.log(i, arguments);
});
}
return a;
}
console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));
yankozlovskiy sends brownie points to @stranger26 :sparkles: :thumbsup: :sparkles:
:star: 76 | @stranger26 | http://www.freecodecamp.com/stranger26
<link href="http://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;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img src="https://bit.ly/fcc-relaxing-cat">
<p class="red-text">Shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
stranger26 sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 513 | @catapixel | http://www.freecodecamp.com/catapixel
function palindrome(str) {
var palLength = str.length;
return true;
}
palindrome("eye");
Can someone tell me why this throws an error 'palLength is not defined' please?
fennekbe sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 514 | @catapixel | http://www.freecodecamp.com/catapixel
thanks for the response @fennekbe
here's my finished code for "Return Largest Numbers in Arrays". Open to critique if it could be streamlined or simpler
'''
function largestOfFour(arr) {
var largestArray = [];
/searches each nested array individually/
for(var i = 0; i < arr.length; i++){
var largestOfOne = 0;
/iterates through the nested array to find the largest value/
for(var i2 = 0; i2 < arr[i].length; i2++){
if(largestOfOne <= arr[i][i2]){
largestOfOne = arr[i][i2];
}
}
/pushes the largest value of the nested array to a new array/
largestArray.push(largestOfOne)
}
return largestArray;
'''
funksy sends brownie points to @fennekbe :sparkles: :thumbsup: :sparkles:
:star: 183 | @fennekbe | http://www.freecodecamp.com/fennekbe
funksy sends brownie points to @fennekbe :sparkles: :thumbsup: :sparkles:
:warning: funksy already gave fennekbe points
function largestOfFour(arr) {
var largestArray = [];
/*searches each nested array individually*/
for(var i = 0; i < arr.length; i++){
var largestOfOne = 0;
/*iterates through the nested array to find the largest value*/
for(var i2 = 0; i2 < arr[i].length; i2++){
if(largestOfOne <= arr[i][i2]){
largestOfOne = arr[i][i2];
}
}
/*pushes the largest value of the nested array to a new array*/
largestArray.push(largestOfOne)
}
return largestArray;
funksy sends brownie points to @fennekbe and @rafase282 :sparkles: :thumbsup: :sparkles:
:warning: funksy already gave fennekbe points
:star: 569 | @rafase282 | http://www.freecodecamp.com/rafase282
function largestOfFour(arr) {
//our final 4 champion element array with the champion variable
var finArray = [];
var champion = 0;
//for each small array
arr.forEach(function (smallArray) {
//iterate through small array and find champion
smallArray.forEach(function (x) {
if (champion < x) {
champion = x;
}
});
//store champion into the final array and reset champion
finArray.push(champion);
champion = 0;
});
return finArray;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
in the waypoint make a dead link using hash symbol but i did the task but it wouldn't accept it here is the current code: <link href="http://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 #="http://www.freecatphotoapp.com">cat photos</a>.</p>
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
<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 class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
burgustu sends brownie points to @funksy :sparkles: :thumbsup: :sparkles:
:star: 187 | @funksy | http://www.freecodecamp.com/funksy
funksy sends brownie points to @marc :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for marc
funksy sends brownie points to @marcbaetica :sparkles: :thumbsup: :sparkles:
:star: 79 | @marcbaetica | http://www.freecodecamp.com/marcbaetica
sorry marcbaetica, you can't send brownie points to yourself! :sparkles: :sparkles:
marcbaetica sends brownie points to @funksy :sparkles: :thumbsup: :sparkles:
:star: 188 | @funksy | http://www.freecodecamp.com/funksy
fennekbe sends brownie points to @funksy and @werber :sparkles: :thumbsup: :sparkles:
:star: 190 | @funksy | http://www.freecodecamp.com/funksy
:star: 207 | @werber | http://www.freecodecamp.com/werber
.smaller-image { width: 100px; height: 100px; }
[2,4,5].some(function(el) {
if(function(el) {return num % 2 === 0}) {
return el;
}
});
for (var i = 0; i <= str.length; i++) {
str = str.toLowerCase().replace(/\W/, "").replace("_", "").replace("_", "").replace(" ", "");
}
When I do it like this, it doesn't remove all symbols/\W/g
- by default String.replace
only replaces the first instance of a string. The only way to replace more than one is to use a global regex
for
loop, and you've got duplicate .replace("_", "")
@alanbuchanan @MattYamamoto @SaintPeter I appreciate trying to help but I'm really just trying to understand the logic here, even if the method i'm using isn't the most prefered one.
If I test with .replace it takes 1 symbol out. If I loop through for the amount of symbols I have in my var, it should remove all the ones that I want it to, right? But it doesn't
function palindrome(str) {
// Good luck!
for (var i = 0; i <= str.length; i++) {
str = str.toLowerCase().replace(/\W/, "").replace("_", "").replace(" ", "");
}
var reverse = str.split('').reverse().join('');
if ( str.toString() == reverse .toString()) {
return true;
} else {
return false;
}
}
palindrome("0_0 (: /-\ :) 0-0");
fennekbe sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 418 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
str = str.toLowerCase().replace(/\W/g, "") return str == str.split('').reverse().join('') ? true : false;
When you do many calls of replace, you just chain it all together, but it not effectively.
str
whose reference (by length) is how long your loop should run. in each iteteration of the loop your end condition changes. So the loop is not running the number of times you expect
fennekbe sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 392 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
display: flex
, which I'm not familiar with, on your vcenter class that is causing the issue. And I think there are issues with your row-fluid
and row-slide
css classes.... are those from the animate library you're using? I think you just have some compatability issues with everything you're trying to use.
teamegebru sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1190 | @saintpeter | http://www.freecodecamp.com/saintpeter
The number beside your picture on Free Code Camp tells you how many Brownie Points you have.
There are three ways you can get Brownie Points:
Brownie Points help you look like the kind of person who codes a lot, shares relevant links, and helps people.
They also add to your Streak.
:pencil: read more about brownie points on the FCC Wiki
function smallestCommons(arr) {
return arr;
}
smallestCommons([1,5]);
Find the smallest number that is evenly divisible by all numbers in the provided range.
more info:
bf details
|bf links
|hint
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
position: absolute
INSIDE a div that is position: relative
, the absolute will be relative to the relative div . . if that makes sense. And because it's absolute, it will "hover" over everything.
cylokko sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1193 | @saintpeter | http://www.freecodecamp.com/saintpeter
auto-complete
div. position that sub-container properly and give the auto-complete
div a top
offset to push it below your input box.
left
position to the autocomplete box
arr = ['1', '2', '3'];
for (var i=0; i < arr.length; i++) {
arr[i] = parseInt(arr[i]);
}
@MindfulBell make the autocomplete box completely independant and use this css:
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
That'll center the whole thing on the screen.
mindfulbell sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1195 | @saintpeter | http://www.freecodecamp.com/saintpeter
.auto-entries
has a margin of -10px
.auto-entries {
margin: -10px; /* Gotta fix this */
height: 20px;
}
funkybunch2006 sends brownie points to @twhite96 and @twhite96 :sparkles: :thumbsup: :sparkles:
:star: 73 | @twhite96 | http://www.freecodecamp.com/twhite96
:star: 73 | @twhite96 | http://www.freecodecamp.com/twhite96
function decoder(key, code) {
return code.map(function(number) {
return key[number];
});
}
decoder("ABCDEFGHIJKLMNOPQRSTUVWXYZ", [2, 14, 3, 8, 13, 6]);
What can I do to make my code return a string instead of an array?
$( document ).ready(function() {
// function random()
$('#btn1').click(function(){
var rand = Math.floor((Math.random() * 10));
var quoteSend = quotes[rand];
$('#output').html(quotes[rand]);
});
$('#twitterQuote').html('<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=' + quoteSend + '"> Tweet</a>');
});
$( document ).ready(function() {
// function random()
var quoteSend;
$('#btn1').click(function(){
var rand = Math.floor((Math.random() * 10));
quoteSend = quotes[rand];
$('#output').html(quotes[rand]);
});
$('#twitterQuote').html('<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=' + quoteSend + '"> Tweet</a>');
});
$( document ).ready(function() {
// function random()
$('#btn1').click(function(){
var rand = Math.floor((Math.random() * 10));
var quoteSend = quotes[rand];
$('#output').html(quotes[rand]);
$('#twitterQuote').html('<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=' + quoteSend + '"> Tweet</a>');
});
});
function decoder(key, code) {
for (var i = 0; i <= code.length; i++) {
if (code[i] < 0 || code[i] === code[i].toString()) {
return "Error: You must enter a number greater than or equal to 0";
}
}
return code.map(function(number) {
return key[number];
}).join('');
}
decoder("ABCDEFGHIJKLMNOPQRSTUVWXYZ", [2, 14, 3, 8, 13, 6]);
It's saying that it's undefined even though it is defined in the argument. What is happening here?
for (var i = 0; i <= code.length; i++) {
should be for (var i = 0; i < code.length; i++) {
yankozlovskiy sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1461 | @dting | http://www.freecodecamp.com/dting
i <= code.length-1
but that is 3 extra characters and not more clear so most people will just use < and no -1