get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
Waypoint: Add Borders Around your Elements
`
<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: 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">
<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>
`
<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">
str.split('').join('')
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
absolutestunna sends brownie points to @hansinla and @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 540 | @hansinla | http://www.freecodecamp.com/hansinla
:star: 603 | @abhisekp | http://www.freecodecamp.com/abhisekp
<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: 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">
<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>
jauble sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 604 | @abhisekp | http://www.freecodecamp.com/abhisekp
function myReplace(str, check, replacer) {
var wordSlice = str.split(" ");
for (var i=0; i<wordSlice.length; i++){
if (wordSlice[i] === check){
var check = wordSlice[i]
wordSlice.splice(wordSlice.indexOf(check), 1, replacer)
}
}return wordSlice
}
myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
gregfoley sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 541 | @hansinla | http://www.freecodecamp.com/hansinla
Sorry, can't find a bonfire called search and destroy. [ Check the map? ]
function replace(str, before, after) {
return str;
}
replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Perform a search and replace on the sentence using the arguments provided and return the new sentence.
more info:
bf details
|bf links
|hint
var check = wordSlice[i]
Return the remaining elements of an array after chopping off n elements from the head. Factorials are often represented with the shorthand notation n!
For example: slasher([1, 2, 3], 2);
must return [3]
:pencil: read more about bonfire slasher flick on the FCC Wiki
<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: 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">
<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>
border: 10px solid green;
veeshostak sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1412 | @dting | http://www.freecodecamp.com/dting
[“hello”, “hey”]
to [“hello”],[“hey”]
var newArray = array1.pop()
hello guys, having a bit of a problem with Waypoint 39 in Basic Javascript
$($(".slot") [0]).html(slotOne);
$($(".slot") [1]).html(slotTwo);
$($(".slot") [2]).html(slotThree);
Is his code correct?
$($(".slot")[0]).html(slotOne);
$($(".slot")[1]).html(slotTwo);
$($(".slot")[2]).html(slotThree);
// var numbers = [1,2,3];
// console.log(numbers); // logs [1,2,3]
// var removed = numbers.pop();
// console.log(numbers); // logs [1,2]
// console.log(removed); // logs 3
var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
myArray = myArray.pop("cat",2);
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]
myArray = myArray.pop("john",23);
// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);
var removed = array;
line
var removed = myArray.pop("cat",2);
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23] // DELETE THIS
pop()
on an array removes the last element of the array and returns it.
varunu28 sends brownie points to @kofiakorli and @camperbot :sparkles: :thumbsup: :sparkles:
:star: 364 | @camperbot | http://www.freecodecamp.com/camperbot
:star: 169 | @kofiakorli | http://www.freecodecamp.com/kofiakorli
var pop = ("John",23);
?
someArray.pop()
.
var someArray = [ 1, 2, 3, 4, 5];
var someResult = someArray.pop()`
// someResult contains 5, the last number on someArray
var removed = myArray.pop();
should work, but you may have some other code still there. That needs to be the ONLY code with removed
["John",23]
not like this ("John",23)
var removed = myArray.pop("cat",2);
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]
var removed = myArray.pop("John",23);
var removed = myArray.pop();
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
// Only change code below this line.
var removed = myArray.pop("cat",2);
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]
var removed = myArray.pop();
// Only change code above this line.
// Only change code below this line.
var removed = myArray.pop();
// Only change code above this line.
:trollface: troll problems? notify admins here
var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
var removed = myArray.pop();
// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);
bruglesco sends brownie points to @kofiakorli and @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 172 | @kofiakorli | http://www.freecodecamp.com/kofiakorli
:star: 606 | @abhisekp | http://www.freecodecamp.com/abhisekp
bruglesco sends brownie points to @kofiakorli :sparkles: :thumbsup: :sparkles:
:warning: bruglesco already gave kofiakorli 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
emersonp sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 607 | @abhisekp | http://www.freecodecamp.com/abhisekp
function getQuot() {
var quotations = ["We can never give up longing and wishing while we are thoroughly alive. There are certain things we feel to be beautiful and good, and we must hunger after them.@George Eliot#The Mill on the Floss", "How wonderful it is that nobody need wait a single moment before starting to improve the world.@Anne Frank#The Diary of a Young Girl", "There will be little rubs and disappointments everywhere, and we are all apt to expect too much; but then, if one scheme of happiness fails, human nature turns to another; if the first calculation is wrong, we make a second better: we find comfort somewhere.@Jane Austen#Mansfield Park", "Fight till the last gasp.@William Shakespeare#Henry VI, Part One", "Get busy living or get busy dying.@Stephen King#The Shawshank Redemption", "We are all in the gutter, but some of us are looking at the stars.@Oscar Wilde#Lady Windermere's Fan", "The sun himself is weak when he first rises, and gathers strength and courage as the day gets on.@Charles Dickens#The Olde Curiosity Shop", "They wanted to speak, but could not; tears stood in their eyes. They were both pale and thin; but those sick pale faces were bright with the dawn of a new future, of a full resurrection into a new life. They were renewed by love; the heart of each held infinite sources of life for the heart of the other.@Fyodor Dostoevsky#Crime and Punishment"]
quotation = quotations[Math.floor(Math.random() * quotations.length)];
return [quotation.split('@')[0]].concat(quotation.split('@')[1].split('#'))
};
$(document).ready(function() {
var quotSet = getQuot();
$(".random-quotation").text(quotSet[0]);
$(".random-author").text(quotSet[1]);
$(".random-text").text(quotSet[2]);
$(".twitter-share-button").attr("data-text", quotSet[0]);
$(".go").click(function() {
var quotSet = getQuot();
$(".twitter-share-button").attr("data-text", quotSet[0]);
$(".random-quotation").text(quotSet[0]);
$(".random-author").text(quotSet[1]);
$(".random-text").text(quotSet[2]);
});
});
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
@KofiAkorli What about the adage
Break it till you make it.
@KofiAkorli Well, it's actually
Fake it till you make it. ;)
@emersonp
Get busy living or get busy dying.
emersonp sends brownie points to @abhisekp and @mattyamamoto :sparkles: :thumbsup: :sparkles:
:warning: emersonp already gave abhisekp points
:star: 380 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
levyian sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 608 | @abhisekp | http://www.freecodecamp.com/abhisekp
shift
. Isn't it?
var arr = [2, 5, 6];
arr.push(arr.shift()) && arr;
// [5, 6, 2]
arr.push(arr.shift()) && arr;
// [6, 2, 5]
arr.push(arr.shift()) && arr;
// [2, 5, 6]
shift
method returns the popped out value, we push the returned value in by passing it to arr.push
method.push
method returns the length
of the array, we can't assign it to anything and if we want to assign, then we must return the modified array. Hence, the && arr
ensures that I evaluate the 2nd operand of &&
which will make the output of the whole expression as the arr
itself.tq
function chunk(arr, size) {
// Break it up.
return arr;
}
chunk(['a', 'b', 'c', 'd'], 2);
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
more info:
bf details
|bf links
|hint
function chunk(arr, size) {
// Break it up.
return arr;
}
chunk(['a', 'b', 'c', 'd'], 2);
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.haribol007 sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 609 | @abhisekp | http://www.freecodecamp.com/abhisekp
levyian sends brownie points to @jlbelljr :sparkles: :thumbsup: :sparkles:
:star: 110 | @jlbelljr | http://www.freecodecamp.com/jlbelljr
joellindsey sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1415 | @dting | http://www.freecodecamp.com/dting
// Only change code below this line.
this.speed;
function addUnit(value) {
return value + "KM/H";
}
public Bike.getSpeed = function () {
return addUnit(speed);
};
};
// Only change code above this line.
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
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!
//Let's create an object with two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var Bike = function() {
// Only change code below this line.
this.speed;
function addUnit(value) {
return value + "KM/H";
}
public Bike.getSpeed = function () {
return addUnit(speed);
};
};
// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();
if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
...
//Let's create an object with two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var Bike = function() {
// Only change code below this line.
this.speed;
function addUnit(value) {
return value + "KM/H";
}
public Bike.getSpeed = function () {
return addUnit(speed);
};
};
// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();
if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
var something = ...
instead of this.something = ...
.getSpeed
to be public you should use this.getSpeed (Iwithout the
public`)
function chunk(arr, size) {
// Break it up.
var newArray = [];
var subArray = [];
var cursor = 0;
for (var i = 0; i < arr.length; i++){
if(subArray.length < size){
subArray.push(arr[i]);
}else{
newArray.push(subArray);
subArray = [];
}
}
return newArray;
}
chunk(["a", "b", "c", "d"], 2);
if(subArray.length <= size)
} else {
i <= arr.length
subArray.push(arr[i]);
at the end of the } else {
subArray = [arr[i]];
subArray = [arr[i]];
will reinitialize subArray
with an array containing only what is in arr[i]
CAN any one help me with this question?
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
What I would like to know is what function does “this” have?
I completed it but still don’t know what this does or do.
this.gear
refers to the gear
property of whichever object contains that code. outside of the object definition, you would access it via Car.gear,
lionelx1 sends brownie points to @jedpimentel :sparkles: :thumbsup: :sparkles:
:star: 367 | @jedpimentel | http://www.freecodecamp.com/jedpimentel
function palindrome(str) {
// Good luck!
str = str.replace(/(.)/g,'')
str = str.toLowerCase().replace(/[\s,._-]+/g,'')
str2 = str.replace(/(.)/g,'')
str2 = str.toLowerCase().replace(/[\s,._-]+/g,'').split('').reverse().join('')
if (str === str2) {
return true;
}
else {
return false;
}
}
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
\W = [^A-Za-z0-9_]
_
, use \W_
[^A-Za-z0-9]
but that's too cumbersome.
\W
or _
i.e. [\W_]
or w/o character class \W|_
.
sparksmkii sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 612 | @abhisekp | http://www.freecodecamp.com/abhisekp
str.replace(/\W|_/g, '')
iamads sends brownie points to @levyian :sparkles: :thumbsup: :sparkles:
:star: 321 | @levyian | http://www.freecodecamp.com/levyian
cbell21985 sends brownie points to @mini890 :sparkles: :thumbsup: :sparkles:
:star: 116 | @mini890 | http://www.freecodecamp.com/mini890
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
return
would end the current function and give the parameter as the return value. Instead, you want to assign to those variables. What does your code (between the two lines "below this line" and "above this line") look like?
git push origin <BRANCHNAME>
@josephwasily the link may be fine, 403 means unauthorized. Github requires SSH keys to pull from repo via ssh. Username and Password will work if you use HTTP link instead. But then you won't be able to push. @samosale. For reference: 10.4.4 403 Forbidden
"The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead."
josephwasily sends brownie points to @lacostenycoder :sparkles: :thumbsup: :sparkles:
:star: 203 | @lacostenycoder | http://www.freecodecamp.com/lacostenycoder
Agent pid 3187
@lacostenycoder I am trying to follow this exercises http://jlord.us/git-it/challenges/branches_arent_just_for_birds.html
I am stuck in the last chalenge to push my update to My fork
var Car = function() {
this.wheels = 4;
};
// Only change code below this line.
var myCar = new Car();
var Const = function () {
this.engines = 1;
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 = 4;
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
git branch samosale
new car()
the Const?
samosale sends brownie points to @takumar and @takumar and @lacostenycoder :sparkles: :thumbsup: :sparkles:
:star: 204 | @lacostenycoder | http://www.freecodecamp.com/lacostenycoder
:star: 499 | @takumar | http://www.freecodecamp.com/takumar
:star: 499 | @takumar | http://www.freecodecamp.com/takumar
jimillett sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 377 | @moigithub | http://www.freecodecamp.com/moigithub
josephwasily sends brownie points to @lacostenycoder :sparkles: :thumbsup: :sparkles:
:warning: josephwasily already gave lacostenycoder points
@lacostenycoder
darko@android-c5e6e6764297878 ~/patchwork $ git push origin samosale
fatal: 'git@github.com/samosale/patchwork.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
function truncate(str, num) {
if(str.length <= 3) {
str= str.split('').splice(0,num).join("");
str+= "...";
return str;
}else {
str= str.split('').splice(0,num-3).join("");
str+= "...";
return str;
}
}
git remote -v
and see if both for fetch and push are set to your repository: "https://github.com/samosale/patchwork.git"
function truncate(str, num) {
// Clear out that junk in your trunk
if(str.length>num){
return str.slice(0,num-3)+"...";
}
else {
return str;
}
};
truncate("A-tisket a-tasket A green and yellow basket", 11);
designviacode sends brownie points to @josephwasily :sparkles: :thumbsup: :sparkles:
:star: 159 | @josephwasily | http://www.freecodecamp.com/josephwasily
function factorialize(num) {
var sum = num
for (var i=1; i<(num) ; ++i) {sum = (sum*i)}
if (sum>0) {return sum;}
else {return 1}
;
}
factorialize(5);
i<(num)
these parentheses are not needed for sure (but of course they are not bug.
garanimal sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 502 | @takumar | http://www.freecodecamp.com/takumar
git checkout add-samosale
, i get this
function factorialize(num) {
var array =[1]
for (var i=1; i<=num; i++) {array.push(i)}
var arrayFact = array.reduce(function(prev,curr){return prev*curr;});
return arrayFact
;
}
factorialize();
/ var ourDog = {
// "name": "Camper",
// "legs": 4,
// "tails": 1,
// "friends": ["everything!"]
// };
// ourDog.bark = "arf!";
// delete ourDog.tails;
var myDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": []
};
// Only change code below this line.
// Let's add the property bark to myDog
bark.myDog =
// Now delete the property tails
delete.bark myDog
// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(z){return z;})(myDog);
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!
samosale sends brownie points to @josephwasily and @lacostenycoder and @takumar :sparkles: :thumbsup: :sparkles:
:star: 205 | @lacostenycoder | http://www.freecodecamp.com/lacostenycoder
:star: 503 | @takumar | http://www.freecodecamp.com/takumar
:star: 161 | @josephwasily | http://www.freecodecamp.com/josephwasily
type bonfire name
to get some info on that bonfire. And check HelpBonfires chatroom
function where(collection, source) {
var arr = [];
// What's in a name?
return arr;
}
where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
more info:
bf details
|bf links
|hint
function factorialize(num) {
return num;
}
factorialize(5!);
5! = 1*2*3*4*5 = 120
:bulb: to format code use backticks! ``` more info
cooljoe21 sends brownie points to @josephwasily and @garanimal and @saifcoding :sparkles: :thumbsup: :sparkles:
:star: 178 | @garanimal | http://www.freecodecamp.com/garanimal
:star: 80 | @saifcoding | http://www.freecodecamp.com/saifcoding
:star: 162 | @josephwasily | http://www.freecodecamp.com/josephwasily
function factor(num){
if (num == 1){
return 1;
}
else {
return num*factor(num-1);
}
}
Waypoint: Size your Images
CSS has a property called width that controls an element's width. Just like with fonts, we'll use px (pixels) to specify the image's width.
For example, if we wanted to create a CSS class called larger-image that gave HTML elements a width of 500 pixels, we'd use: <style> .larger-image { width: 500px; } </style>.
Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide.
<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">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>
sergistud sends brownie points to @saifcoding :sparkles: :thumbsup: :sparkles:
:star: 85 | @saifcoding | http://www.freecodecamp.com/saifcoding
function spinalCase(str) {
// "It's such a fine line between stupid, and clever."
// --David St. Hubbins
return str;
}
spinalCase('This Is Spinal Tap');
Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.
more info:
bf details
|bf links
|hint
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
h4r1m4u sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 469 | @catapixel | http://www.freecodecamp.com/catapixel
function chunk(arr, size) {
// Break it up.
var newArray = [];
var subArray = [];
for (var i = 0; i < arr.length; i++){
if(subArray.length < size){
subArray.push(arr[i]);
}else{
newArray.push(subArray);
subArray = [];
subArray.push(arr[i]);
}
}
newArray.push(subArray);
return newArray;
}
chunk(["a", "b", "c", "d"], 2);
celsom3 sends brownie points to @marzelin and @alexhudici and @kmiasko :sparkles: :thumbsup: :sparkles:
:star: 206 | @kmiasko | http://www.freecodecamp.com/kmiasko
:star: 49 | @alexhudici | http://www.freecodecamp.com/alexhudici
:star: 359 | @marzelin | http://www.freecodecamp.com/marzelin
This problem is a bit tricky because you have to familiarize yourself with Arguments, as you will have to work with two or more but on the script you only see two. Many people hardcode this program for three arguments. You will remove any number from the first argument that is the same as any other other arguments.
:pencil: read more about bonfire seek and destroy on the FCC Wiki
function pair(str) {
return str;
}
pair("GCG");
The DNA strand is missing the pairing element. Match each character with the missing element and return the results as a 2d array.
more info:
bf details
|bf links
|hint
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
stevereally sends brownie points to @samosale and @mini890 :sparkles: :thumbsup: :sparkles:
:star: 174 | @mini890 | http://www.freecodecamp.com/mini890
:star: 387 | @samosale | http://www.freecodecamp.com/samosale
shehannf sends brownie points to @mini890 :sparkles: :thumbsup: :sparkles:
:star: 175 | @mini890 | http://www.freecodecamp.com/mini890
philandy sends brownie points to @mini890 :sparkles: :thumbsup: :sparkles:
:star: 176 | @mini890 | http://www.freecodecamp.com/mini890
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
Hey everyone, I'm working on the Build a Wikipedia Viewer Zipline exercise. I've been reading up on the Wikipedia API documentation, AJAX, CORS, and HTTP Headers and I've already been able to successfully use JSON API's on the previous two exercises (Twitch.TV and Stylize Camper News).
I keep running into the following type of errors when I try to run my code:
XMLHttpRequest cannot load http://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=beer. Response for preflight is invalid (redirect)
index.html:1
or
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=beer. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Here is my function's code:
function searchWiki(str) {
var xhr = new XMLHttpRequest();
var searchTerm = str;
var url = "http://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=" + searchTerm;
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var jsonArr = JSON.parse(xhr.responseText);
document.getElementById('results').innerHTML = "Success!";
document.getElementById('results').innerHTML += jsonArr;
console.log(jsonArr);
} else {
document.getElementById('results').innerHTML = "Error<br />URL: " + url + "<br />Ready State: " + xhr.readyState + "<br />Status: " + xhr.status;
}
}
xhr.open("GET", url, true);
xhr.setRequestHeader('Access-Control-Allow-Origin', 'http://codepen.io/');
xhr.setRequestHeader('Api-User-Agent', 'RonsWikiSearchProject/1.0' );
xhr.send();
}
Can anyone help point out what I'm doing wrong to not pass the preflight tests and not retrieve the JSON text back from Wikipedia? Any help would be greatly appreciated.
&callback=?
at the end of your url
gitarman sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 381 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
&callback=?
to the end of my URL doesn't seem to be working. I still get the following error: 'XMLHttpRequest cannot load http://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=beer&callback=?. Response for preflight is invalid (redirect)'
nums.forEach(function(value, index) {
while (num >= value) {
arr.push(index);
console.log(arr);
num -= value;
}
});
.red-text{
color: red;
}
</style>
<h2 class="red-text"> CatPhotoApp </h2>
.red-text{
color: red;
}
</style>
<h2 class="red-text"> CatPhotoApp</h2>
.red-text{
color: red;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
.red-text{
color: red;
}
</style>
<h2 class="red-text"> CatPhotoApp</h2>
function destroyer(arr) {
// Remove all the values
var seek = arr.slice.call(arguments);
var args = seek.slice(1);
var destroy = seek.indexOf(args);
return destroy;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
<h2 style="color:red">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>
ibougithub sends brownie points to @matty22 :sparkles: :thumbsup: :sparkles:
:star: 189 | @matty22 | http://www.freecodecamp.com/matty22
ibougithub sends brownie points to @adtpdn :sparkles: :thumbsup: :sparkles:
:star: 15 | @adtpdn | http://www.freecodecamp.com/adtpdn
@ibouGithub Try deleting all of the style and retyping it?
Can confirm. This fixes it. No idea why
var args = Array.prototype.slice.call(arguments, 1);
.protoype
part of the function do?
array.protype.slice()
array.prototype.slice()
vs array.slice()
hassanchagani sends brownie points to @takumar and @kofiakorli :sparkles: :thumbsup: :sparkles:
:star: 187 | @kofiakorli | http://www.freecodecamp.com/kofiakorli
:star: 504 | @takumar | http://www.freecodecamp.com/takumar
function destroyer(arr) {
// Remove all the values
var seek = arr.slice.call(arguments);
var args = seek.slice(1);
var destroy = args.filter(arr.indexOf(args));
return destroy;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
bkthegeek sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 382 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
var destroy = args.filter(function(val) {
return //blabla
}
function destroyer(arr) {
// Remove all the values
var seek = arr.slice.call(arguments);
var args = seek.slice(1);
var destroy = args.filter(function indexOf(args) {
return arr;
})
return destroy;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
var destroy = arr.filter(function(val) {
return // args doesn't contain val
});
function destroyer(arr) {
// Remove all the values
var seek = arr.slice.call(arguments);
var args = seek.slice(1);
var destroy = arr.filter(function indexOf(args) {
return arr;
})
return destroy;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
var destroyer = arr.filter(function(val) {
// Do stuff in here with args indexof val
return boolean
});
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.
// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
var destroy = arr.filter(function(val) {
return val = arr.indexOf(args)
});
function destroyer(arr) {
// Remove all the values
var seek = arr.slice.call(arguments);
var args = seek.slice(1);
return destroy = arr.filter(function(val) {
return args.indexOf(val)
});
//return destroy;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
returning [1,3,1,3]
bkthegeek sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:warning: bkthegeek already gave hermanfassett points
return args.indexOf(val) === -1