get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
.gray-background
CSS class definition :-)
<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>
i
HI guys,
jQuery,
If I am calling multiple functions, can I make the next one wait until the previous one has finihsed?
setTimeOut()
:bulb: to format code use backticks! ``` more info
function where(collection, source) {
var arr = [];
// What's in a name?
// loop over collection of objects checking to see if any objects contain key: value pairs
// in source object
var sourceKeys = Object.keys(source);
for (var i = 0; i < collection.length; i++) {
if (Object.keys(collection[i]).length >= sourceKeys.length) {
for (var key in source) {
if (collection[i].hasOwnProperty(key)) {
if (collection[i][key] === source[key]) {
arr.push(collection[i]);
}
}
}
}
}
return arr;
}
console.log(where([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 }));
[ { a: 1, b: 2 },
{ a: 1, b: 2 },
{ a: 1, b: 2, c: 2 },
{ a: 1, b: 2, c: 2 } ]
break
or continue
...how might i achieve this with a for in
loop? Any help?
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.smaller-image {
width: 100px;
}
.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">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>
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.smaller-image {
width: 100px;
}
.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">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>
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<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
mcgratcj sends brownie points to @cragsify :sparkles: :thumbsup: :sparkles:
:star: 292 | @cragsify | http://www.freecodecamp.com/cragsify
what am i doing wrong? cant get the body element color green, or Your h1 element should inherit the color green from your body element. This is what i have so far. <style>
body {
background-color: green;
font-family: Monospace;
}
</style>
<h1 class="background-color">Hello World</h1>
body {
background-color: green;
font-family: Monospace;
}
</style>
<h1 class="background-color">Hello World</h1>
.header {
background: url("http://i.imgur.com/WYZt699.jpg") center center no-repeat;
padding: 0;
margin: 0;
height: 500px;
}
The image is in this CSS code.
vh
maybe?
<form action="/submit-cat-photo">
<input type="text" placeholder="cat photo URL" required>
<labeL>
<input type="radio" name="indoor-outdoor"> indoor
</label>
<label>
<input type="radio" name="indoor-outdoor"> outdoor
</label>
<button type="submit">Submit</button>
</form>
function check(value){
return value !== this;
}
function destroyer(arr) {
// Remove all the values
for(var i = 1; i < arguments.length; i++){
arr = arr.filter(check, arguments[i]);
}
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
:bulb: to format code use backticks! ``` more info
mca62511 sends brownie points to @robmo :sparkles: :thumbsup: :sparkles:
:star: 132 | @robmo | http://www.freecodecamp.com/robmo
$(document).ready(function(){
$("p").hide();<-------this how you target p tag
});
@raiden357
// Example
var firstName = "Ada";
var secondLetterOfFirstName = firstName[1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
var thirdLetterOfLastName = "v";
var lastname = [3];
But... the rules say.
Give it your own personal style.
So perhaps it doesn't matter so much
yskilly sends brownie points to @mca62511 :sparkles: :thumbsup: :sparkles:
:star: 266 | @mca62511 | http://www.freecodecamp.com/mca62511
raiden357 sends brownie points to @robmo :sparkles: :thumbsup: :sparkles:
:star: 133 | @robmo | http://www.freecodecamp.com/robmo
I'm just starting from scratch, and I am struggling to add borders to an image. This is what I've done so far: .smaller-image {
width: 100px;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img class="smaller-image" "thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">
function rot13(str) { // LBH QVQ VG!
var array = str.split(" ");
var arrTemp =[];
for (var i = 0; i < array.length; i++){
for (var j = 0; j < array[i].length; j++){
arrTemp.push(array[i][j].charCodeAt());
}
arrTemp.push(32);
}
var tempArray = [];
var string = "";
for (i = 0; i < arrTemp.length; i++){
var temp = arrTemp[i];
if (temp !== 32){
if (temp >= 65 && temp <= 77){
temp += 13;
}else if(temp > 77 && temp <= 90){
temp -= 13;
}
string +=String.fromCharCode(temp);
}else {
string += " ";
}
}
return string;
}
// Change the inputs below to test
rot13("GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.");
I have got right answer, but still can't pass it!!!!!
charCodeAt()
.
arrTemp.push(array[i][j].charCodeAt(0));
Still can work
<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;
}
img {
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img 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>
sphinxlikewayne sends brownie points to @ldwx :sparkles: :thumbsup: :sparkles:
:star: 266 | @ldwx | http://www.freecodecamp.com/ldwx
<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;
}
.smaller-image{
width: 100px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img src="https://bit.ly/fcc-relaxing-cat" class="smaller-image">
<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>
This is my code@LDWX Hint: With
arrTemp.push(array[i][j].charCodeAt(0));
you are referring to the value at index 0
throughout the loop. You should replace 0
with a variable.
@kmulligan Yes. Pure functions have no side effects: they receive a value and they return a value, without modifyng the entering value or, God forbid, variables from the outside scope. There are many benefits to programming in a functional style, including ease of testing, debugging and much, much, much better composability.
@marcusmonteiro thanks for this... will do my best to remember
sorry kmulligan, you can't send brownie points to yourself! :sparkles: :sparkles:
:star: 92 | @marcusmonteiro | http://www.freecodecamp.com/marcusmonteiro
rafase282 sends brownie points to @kmulligan :sparkles: :thumbsup: :sparkles:
:star: 275 | @kmulligan | http://www.freecodecamp.com/kmulligan
for (var i = 0; i < array.length; i++){
for (var j = 0; j < array[i].length; j++){
arrTemp.push(array[i].charCodeAt(j));
}
arrTemp.push(32);
}
That still doesn't work.
@pradeepce
function rot13(str) { // LBH QVQ VG!
var array = str.split(" ");
var arrTemp =[];
for (var i = 0; i < array.length; i++){
for (var j = 0; j < array[i].length; j++){
arrTemp.push(array[i].charCodeAt(j));
}
arrTemp.push(32);
}
var tempArray = [];
var string = "";
for (i = 0; i < arrTemp.length; i++){
var temp = arrTemp[i];
if (temp !== 32){
if (temp >= 65 && temp <= 77){
temp += 13;
}else if(temp > 77 && temp <= 90){
temp -= 13;
}
string +=String.fromCharCode(temp);
}else {
string += " ";
}
}
return string;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
I have right result , but can pass.Does anyone know how to solve it ?
ldwx sends brownie points to @jonselig :sparkles: :thumbsup: :sparkles:
:star: 135 | @jonselig | http://www.freecodecamp.com/jonselig
<div class="container-fluid">
at the top and close the div at the bottom
#id-name { font-size: 200% }
applies to a <p> inside the div with id "id-name", but not to an <h1> in the same div?
fefe-fiona sends brownie points to @jonselig :sparkles: :thumbsup: :sparkles:
:star: 136 | @jonselig | http://www.freecodecamp.com/jonselig
var a=1;
function factorialize(num) {
for (var i=1; i<=num;i++)
{
a=a*i;
}
return a;
}
factorialize(5);
liam345 sends brownie points to @jonselig and @4dsolutions :sparkles: :thumbsup: :sparkles:
:star: 12 | @4dsolutions | http://www.freecodecamp.com/4dsolutions
:star: 137 | @jonselig | http://www.freecodecamp.com/jonselig
<button class="btn btn-info">Like</button>
<
after the Like
)
<button class="btn btn-info">Like</button>
works for me
Create a new button element below your large kitten photo. Give it the class btn and the text of "Like”.
rogers187 sends brownie points to @colvint :sparkles: :thumbsup: :sparkles:
:star: 47 | @colvint | http://www.freecodecamp.com/colvint
$.getJSON("http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=2bfb9a60bdbdfd4d690c66b602546943"), function(weather) {
var temp = weather.main.temp;
console.log(temp);
};
@collinferry
$.getJSON("http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=2bfb9a60bdbdfd4d690c66b602546943", function(weather) {
var temp = weather.main.temp;
console.log(temp);
});
try this
collinferry sends brownie points to @idietmoran :sparkles: :thumbsup: :sparkles:
:star: 295 | @idietmoran | http://www.freecodecamp.com/idietmoran
// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function update(id, prop, value) {
if (id[prop] !== "" && id[prop] !== "tracks"){
id[prop] = "new prop";
}
else if (id[prop] == "tracks" && id[prop].value === ""){
id[prop].value.push();
}
else {
id[prop].delete();
}
return collection;
}
// Alter values below to test your code
update(5439, "artist", "ABBA");
return str == str.split('').reverse().join('');
?
After update(5439, "artist", "ABBA"), artist should be “ABBA"
wiki $topic
info on that topic
The multiple jQuery selectors are:
$("button")
$(".btn")
$("#target1")
<script>
$(document).ready(function() {
$("button").addClass("animated");
$(".btn").addClass("shake");
$("#target1").addClass("btn-primary");
});
</script>
:pencil: read more about challenge target the same element with multiple jquery selectors on the FCC Wiki
create a script
script element
<script>=
$(document).ready(function() {
$("button").addClass("animated");
$(".btn").addClass("shake");
$("#target1").addClass("btn-primary");
});
</script>
<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>=
<script type="text/javascript">..</script>
kevinstaufy sends brownie points to @rhutchison :sparkles: :thumbsup: :sparkles:
:star: 15 | @rhutchison | http://www.freecodecamp.com/rhutchison
<!-- Only change code above this line. -->
<script>=
$(document).ready(function() {
});
<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>
kevinstaufy sends brownie points to @rhutchison :sparkles: :thumbsup: :sparkles:
:warning: kevinstaufy already gave rhutchison points
kevinstaufy sends brownie points to @colvint :sparkles: :thumbsup: :sparkles:
:star: 52 | @colvint | http://www.freecodecamp.com/colvint
<script>
alert("Hey I’m in javascript");
</script>
function bouncer(arr) {
// Don't show a false ID to this bouncer.
var boun=[];
var l=0;
boun =arr.filter(function(n){
return n !== null && n != "";
});
if (boun[0] !== boun[0]) { //fix me!
return [];
}
return boun;
}
bouncer([7, "ate", "", false, 9]);
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.smaller-image {
width: 100px;
}
.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" class="smaller-image">
<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>
<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">
<style>
.larger-image {
width: 100px;
}
</style>
<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>
brandondoescode sends brownie points to @colvint :sparkles: :thumbsup: :sparkles:
:star: 53 | @colvint | http://www.freecodecamp.com/colvint
` </div>
<input type="form control" placeholder="cat photo URL" required>
<button class="submit btn btn-primary"><i class="fa fa-paper-plane"></i>Submit</button>
</form>
</div>`
[1, 2, 3].push(4)
appends the array & delete person.firstName
unsets the firstname
push
(for arrays ) and delete
(for objects) are handy
<input type="text" class="form-control" placeholder="cat photo URL" required>
```
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.smaller-image {
width: 100px;
}
.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" class="smaller-image">
<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>
```
rogers187 sends brownie points to @rhutchison :sparkles: :thumbsup: :sparkles:
:star: 16 | @rhutchison | http://www.freecodecamp.com/rhutchison
<script>
$(document).ready(function() {
$("button").addClass("animated");
$(".btn").addClasss("shake");
$("#target1").addClass("animated shake btn-primary");
});
</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>
$("#target1").addClass("animated shake btn-primary");
$("#target1").addClass("btn-primary");
addClass
:wink:
kevinstaufy sends brownie points to @marhyorh and @rhutchison :sparkles: :thumbsup: :sparkles:
:warning: kevinstaufy already gave rhutchison points
:star: 610 | @marhyorh | http://www.freecodecamp.com/marhyorh
<style>
h2 {
{color: blue};
}
</style>
<h2>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>
this is the html code but iam unable to change color of h2 ellement
Hi everybody, I'm starting the freeCodeCamp program and I'm doing the Bootstrap part. In one exercise they ask me to nest some button in a div element to apply some col-xs class. I have pretty much done it before and don't see what I can change, here is my code :
<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>
brandondoescode sends brownie points to @appbeza :sparkles: :thumbsup: :sparkles:
:star: 190 | @appbeza | http://www.freecodecamp.com/appbeza
alexx916 sends brownie points to @blazephoenix :sparkles: :thumbsup: :sparkles:
:star: 296 | @blazephoenix | http://www.freecodecamp.com/blazephoenix
naveenm60 sends brownie points to @ajsnetiker :sparkles: :thumbsup: :sparkles:
:star: 293 | @ajsnetiker | http://www.freecodecamp.com/ajsnetiker
lpix sends brownie points to @neeraj-lad :sparkles: :thumbsup: :sparkles:
:star: 295 | @neeraj-lad | http://www.freecodecamp.com/neeraj-lad
freecodecampcomchallengesprofile-lookup
if (contacts[i].hasOwnProperty(prop))
, not if (contacts[i][prop])
(this is a difference if contacts[i][prop]
exists but has a falsy value).return "No such contact"
. Move that one line down (behind the next }
, so it is outside the for-loop), and check the correct spelling.
<script>
$(document).ready(function() {
$(".target:nth-child(2)").addClass("bounce");
});
</script>
<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>
this plz
can someone tell me why it is not working
var contacts = [
{
"firstName": "Akira",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"likes": ["Hogwarts", "Magic", "Hagrid"]
}];
var prop1 = "firstName";
var prop2 = "likes";
console.log( contacts[0].prop1 );
console.log( contacts[0].prop2 );
prop1
and prop2
values as keys to access the contacts objects?
at the moment you are accessing the properties named prop1
and prop1
, you need to dereference them to use the string/value stored in them, the dot notation looks only for a property that is exactly the name you supply, you need to use square brackets to dereference
contacts[0][prop1]
for example
<script>
$(document).ready(function() {
$("button").addClass("animated bounce");
$(".class").addclass()("animated shake");
});
</script>
addClass
on the .class
call
.addClass
instead .addclass
addclass
$(".class").addclass()("animated shake");
should be $(".class").addClass("animated shake");
mycodelongjourney sends brownie points to @tbartels :sparkles: :thumbsup: :sparkles:
:star: 115 | @tbartels | http://www.freecodecamp.com/tbartels
.well
not .class
$(".well").addClass("animated shake");
medhatrinky sends brownie points to @tbartels :sparkles: :thumbsup: :sparkles:
:star: 116 | @tbartels | http://www.freecodecamp.com/tbartels
@vmolmans From the description:
Here's an example of a checkbox:
<label><input type="checkbox" name="personality"> Loving</label>
Add to your form a set of three checkboxes. Each checkbox should be nested within its own
label
element. All three should share thename
attribute ofpersonality
.
contacts.length
instead of contact
return "No such contact";
should be after the loop, when you have checked all contacts for a name match.
budimanfix sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 1185 | @blauelf | http://www.freecodecamp.com/blauelf
vmolmans sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 1186 | @blauelf | http://www.freecodecamp.com/blauelf
http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_=14
55542014951
rogerskeie sends brownie points to @idietmoran :sparkles: :thumbsup: :sparkles:
:star: 296 | @idietmoran | http://www.freecodecamp.com/idietmoran
@idietmoran It gives this json string every time I click the button:
[{"ID":161,"title":"Pablo Picasso","content":"
I am always doing that which I can not do, in order that I may learn how to do it.
\n","link":"http://quotesondesign.com/pablo-picasso/","custom_meta":{"Source":"website"}}]
<style>
.red-text {color : red ;}
h2 {
}
</style>
<h2 class ="red-text">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>
error says stylesheet should declare red-text class
.red-text{
color:red;
}
samanvaym sends brownie points to @urobert and @niconiahi :sparkles: :thumbsup: :sparkles:
:star: 587 | @urobert | http://www.freecodecamp.com/urobert
:star: 27 | @niconiahi | http://www.freecodecamp.com/niconiahi
@rogerskeie here's another solution:: load 10 results (you can change the results loaded in the url GET request)
point your browser here
quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10&_=14 55542014951
then make a function to get a random number every time you click and pull that position in the array
quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10&_=14 55542014951
rogerskeie sends brownie points to @idietmoran :sparkles: :thumbsup: :sparkles:
:warning: rogerskeie already gave idietmoran points
<div class="container-fluid">
<h2 class="text-primary text-center">CatPhotoApp</h2>
<a href="#"><img class="img-responsive 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">
<div class="col-xs-4">
arr.push(item);
. Then, remove the first element and return it, for example using arr.shift()
.
@Blauelf I did so.
function queue(arr, item) {
var queue = [arr,item]; // Your code here
var addFirst = queue.push([1,2,3,4,5]);
var removeQueue = queue.shift();
return item; // Change this line
}
queue
to something like [[4,8,15,16,23],42]
, which is not an array of numbers. And what does that [1,2,3,4,5]
mean? Why do you return the item you were supposed to put at the end, and not the removed one? BTW, you are using shift on the wrong array, arr should be changed.
<div class="container-fluid">
<div class="row">
<div class="col-xs-8">
<h2 class="text-primary text-center">CatPhotoApp</h2>
</div>
<!-- do the same to the link/image, using col-xs-4 instead -->
<a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>
</div>
<img src="http://bit.ly/fcc-running-cats" class="img-responsive">
<div class="row">
<div class="col-xs-4">
arr.push(item);
, to add item to the end of arr.arr.shift()
to return the first element while removing it. You can either store it into a variable, or return it right away, using return arr.shift();
.
Hi guys, i cant understand how to return a property's value. It's from Testing Objects for Properties JS challenge.
`
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
if (myObj.hasOwnProperty("checkProp") === true){
return myObj[checkProp];
}
return "Not Found";
}
checkObj("gift");
`
For now it returns Not found.
if (myObj.hasOwnProperty("checkProp") === true){
checkProp
, meaning the variable.
=== true
part if u like...
Hi
Need help with this little project
function convert(celsius) {
// Only change code below this line
// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}
// Change the inputs below to test your code
convert(30);
vivelena sends brownie points to @moigithub and @blauelf and @moigithub :sparkles: :thumbsup: :sparkles:
:star: 1189 | @blauelf | http://www.freecodecamp.com/blauelf
:star: 601 | @moigithub | http://www.freecodecamp.com/moigithub
:star: 601 | @moigithub | http://www.freecodecamp.com/moigithub
style
tag: p {
font-size:16px;
}
If you're trying to tackle this challenge with jQuery's $.getJSON()
method, chances are you'll get an error message concerning Cross-Origin Resource Sharing (CORS).
The easiest way to resolve this is to use jQuery's JSONP capabilities. From the Twitch API's readme page:
All API methods support JSON-P by providing a callback parameter with the request.
Also the jQuery documentation states:
If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead.
Here's an example call to fetch Free Code Camp's Twitch channel data:
$.getJSON('https://api.twitch.tv/kraken/streams/freecodecamp?callback=?', function(data) {
console.log(data);
});
JSONP is considered insecure according to Wikipedia, but should be sufficient for our purposes. For a detailed discussion on Twitch's CORS restriction, please read justintv/Twitch-API#133 on the Twitch-API repository.
:pencil: read more about front end project use the twitchtv json api on the FCC Wiki
random quote
n0bl3 sends brownie points to @pranavdoshi :sparkles: :thumbsup: :sparkles:
:star: 296 | @pranavdoshi | http://www.freecodecamp.com/pranavdoshi
```<div class=".container-fluid">
<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 href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" 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">
<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>```this is my code i have to nest all HTML elements in .container-fluid.
.
in class name i.e: <div class="container-fluid">
container-fluid
is a bootstrap class, its already defined in the bootstrap's style file, linked externally.
fahrenheit = celcius *9/5 +32;
bicabone sends brownie points to @maulikdarji :sparkles: :thumbsup: :sparkles:
vamsidhar2mp sends brownie points to @julianorafael :sparkles: :thumbsup: :sparkles:
:star: 351 | @julianorafael | http://www.freecodecamp.com/julianorafael
bicabone sends brownie points to @neeraj-lad :sparkles: :thumbsup: :sparkles:
:star: 296 | @neeraj-lad | http://www.freecodecamp.com/neeraj-lad
col
divs only, wrap them with row
it works.
vamsidhar2mp sends brownie points to @maulikdarji :sparkles: :thumbsup: :sparkles:
:star: 459 | @maulikdarji | http://www.freecodecamp.com/maulikdarji
@maulikdarji Hey it worked
Can you pls help with How to get these right ?
14
convert(0) should return a number
convert(-30) should return a value of -22
convert(-10) should return a value of 14
convert(0) should return a value of 32
convert(20) should return a value of 68
convert(30) should return a value of 86
@maulikdarji
function convert(celsius) {
// Only change code below this line
fahrenheit = celcius *9/5 + 32;
// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}
// Change the inputs below to test your code
convert(30);
fahrenheit = celcius *9/5 + 32;
to fahrenheit = celsius *9/5 + 32;
:smile:
celcius
to celsius
bbhavesh sends brownie points to @maulikdarji :sparkles: :thumbsup: :sparkles:
:star: 460 | @maulikdarji | http://www.freecodecamp.com/maulikdarji
<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
</style>
<h1>Hello World!</h1>
put
.pink-text { color: pink; }
in your style tags
Or
h1 {
color: pink;
}
(depending on the exact task description)
@mjqblade
<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
.pink-text{
color: pink;
}
</style>
<h1 class="pink-text">Hello World!</h1>
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
// Only change code below this line;
var playerNumber = 16; // Change this Line
var player = testObj[16]; // Change this Line
You should use bracket notation to access testObj. Where should i use it?
:pencil: read more about adding environment variables on the FCC Wiki
<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
}
.pink-text{
color: pink;
}
</style>
<h1 class="pink-text">Hello World!</h1>
bicabone sends brownie points to @username :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for username
me please
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
// Only change code below this line;
var playerNumber = 16; // Change this Line
var player = testObj[16]; // Change this Line
You should use bracket notation to access testObj. Where should i use it?
@bicabone Instructions
Use the playerNumber variable to lookup player 16 in testObj using bracket notation.
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
// Only change code below this line;
var playerNumber=16; // Change this Line
var player = testObj[playerNumber]; // Change this Line
marselcode sends brownie points to @bicabone :sparkles: :thumbsup: :sparkles:
:star: 62 | @bicabone | http://www.freecodecamp.com/bicabone
how do you replace href with #. i tried but said I did wrong.<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 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>
href="#"
$(".target:nth-child(2)").addClass("animated-bounce");
is this correct
sirens sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 1195 | @blauelf | http://www.freecodecamp.com/blauelf
<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;
}
.smaller-image {
width: 100px;
}
.thick-green-border {
border-color: thick-green;
border-width: 10px;
border-style: solid;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img class="smaller-image" class="thick-green-border" class="border-width 10px" class="style-solid"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>
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 lookUp(firstName, prop){
// Only change code below this line
for(var i = 0; i <= Object.keys(contacts).length; i ++){
if(firstName === contacts[i].firstName && contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
else if(firstName != contacts[i].firstName){
return "No such contact";
}
else {
return "No such property";
}
}
// Only change code above this line
}
// Change these values to test your function
lookUp("Kristian", "lastName");
eliott-champo sends brownie points to @srinivasdasu :sparkles: :thumbsup: :sparkles:
:star: 391 | @srinivasdasu | http://www.freecodecamp.com/srinivasdasu
consultelaine sends brownie points to @pranayberry :sparkles: :thumbsup: :sparkles:
:star: 106 | @pranayberry | http://www.freecodecamp.com/pranayberry
return
statements, this means that the loop will exit whenever a return
is reached, the conditions you set up mean you will call a return
on the first time and never get to the 2nd item
style
property before the styles, and you only need one class
property, combine them; you also need a colon between the border-width
and it's value:<img class="smaller-image thick-green-border style-solid" style="border-width:10px" src="https://bit.ly/fcc-relaxing-cat">
return
statements are used much too early
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<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
tbartels sends brownie points to @cragsify :sparkles: :thumbsup: :sparkles:
:star: 294 | @cragsify | http://www.freecodecamp.com/cragsify
:bulb: to format code use backticks! ``` more info
for(i=0;i<contacts.length;i++)
{
if (contacts[i].firstName===firstName)
{
if(contacts[i].hasOwnProperty(prop))
{
return contacts[i][prop];
}
else
{
return "No such property";
}
}
}
return "No such contact";
dayfiri sends brownie points to @srinivasdasu and @tbartels :sparkles: :thumbsup: :sparkles:
:star: 392 | @srinivasdasu | http://www.freecodecamp.com/srinivasdasu
:star: 137 | @tbartels | http://www.freecodecamp.com/tbartels
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<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
consultelaine sends brownie points to @cragsify :sparkles: :thumbsup: :sparkles:
:star: 295 | @cragsify | http://www.freecodecamp.com/cragsify
This an inline `<paste code here>
` code formatting with a single backtick(`) at start and end around the code
.
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<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
:bulb: to format code use backticks! ``` more info
@tbartels I'm working on Add Borders Around Your Elements..here is all I have <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;
}
.smaller-image {
width: 100px;
}
.thick-green-border {
border-color: thick-green;
border-width: 10px;
border-style: solid;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img class="smaller-image thick-green-border style-solid" style="border-width:10px" 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>
@cragsify I have copy pasted what I have...hope this helps...thanks
consultelaine sends brownie points to @tbartels and @cragsify :sparkles: :thumbsup: :sparkles:
:warning: consultelaine already gave cragsify points
:star: 138 | @tbartels | http://www.freecodecamp.com/tbartels
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.smaller-image {
width: 100px;
}
.thick-green-border {
border-color: thick-green;
border-width: 10px;
border-style: solid;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<img class="smaller-image thick-green-border style-solid" style="border-width:10px" 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>
consultelaine sends brownie points to @cragsify :sparkles: :thumbsup: :sparkles:
:warning: consultelaine already gave cragsify points
mahdirkabir sends brownie points to @robvon86 :sparkles: :thumbsup: :sparkles:
:star: 132 | @robvon86 | http://www.freecodecamp.com/robvon86