30th
Nov 2016
claygoldman
@claygoldman
Nov 30 2016 00:01
Can anybody help with the Celsius to Fahrenheit Code?
Diego Mayer
@Chrono79
Nov 30 2016 00:01
it's really easy (well, at least when you see how it's done), what do you have? @claygoldman
claygoldman
@claygoldman
Nov 30 2016 00:01
I don't have anything yet I'm really cunfused
confused
Diego Mayer
@Chrono79
Nov 30 2016 00:02
@claygoldman basically you have to translate this sentence to one line of code:
Fahrenheit is the temperature in Celsius times 9/5, plus 32.
teisina
@teisina
Nov 30 2016 00:02
guys im stuck on record collection
if(prop==="artist"){
collection.id.artist = value;
}
getting TyperError
Diego Mayer
@Chrono79
Nov 30 2016 00:03
@teisina the only property name you should test is "tracks" (that means prop being "tracks" or not)
And you can't use dot notation with vars
@claygoldman anything?
claygoldman
@claygoldman
Nov 30 2016 00:06
I got the fahrenheit to celsius Thanks.
Diego Mayer
@Chrono79
Nov 30 2016 00:06
:+1:
Easier than it seemed eh?
Kirby James
@kirbygit
Nov 30 2016 00:08
is something wrong with this
var userChoice = prompt("Do you choose rock,paper or scissors?"); var computerChoice = Math.random() console.log(computerChoice); if (computerChoice > 0 && computerChoice < 0.33 ) { computerChoice = "rock"; } else if (computerChoice > 0.34 && computerChoice < 0.66) { computerChoice = "paper"; } else (computerChoice > 0.67 && computerChoice < 1) { computerChoice = "scissors"; }
var userChoice = prompt("Do you choose rock,paper or scissors?"); var computerChoice = Math.random() console.log(computerChoice); if (computerChoice > 0 && computerChoice < 0.33 ) { computerChoice = "rock"; } else if (computerChoice > 0.34 && computerChoice < 0.66) { computerChoice = "paper"; } else (computerChoice > 0.67 && computerChoice < 1) { computerChoice = "scissors"; }
Diego Mayer
@Chrono79
Nov 30 2016 00:09
@kboygit better use  for multiline code
This message was deleted
CamperBot
@camperbot
Nov 30 2016 00:09
:bulb: to format code use backticks!  more info
Diego Mayer
@Chrono79
Nov 30 2016 00:09
Kirby James
@kirbygit
Nov 30 2016 00:10
ok
Diego Mayer
@Chrono79
Nov 30 2016 00:11
@kboygit for what I can see, you can't use else (condition)
it's either else { do something } or else if (condition) { do something }
Kirby James
@kirbygit
Nov 30 2016 00:12
why
Diego Mayer
@Chrono79
Nov 30 2016 00:13
@kboygit that's the way javascript (and a lot of other languages) was made
gabi
@gikwu1
Nov 30 2016 00:14

var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}

{
"artist": "Micheal Jackson",
"title": "Thriller",
"release_year": 1978,
"formats": [
"CD",
"MP",
"8T"],
}
];
what am i doing wrong here anyone? pls?
Diego Mayer
@Chrono79
Nov 30 2016 00:14
@gikwu1 how are array elements separated from one another?
Kirby James
@kirbygit
Nov 30 2016 00:15
thansk
gabi
@gikwu1
Nov 30 2016 00:15
are u asking a question? or an observation?
Diego Mayer
@Chrono79
Nov 30 2016 00:15
a question
Joseph
@revisualize
Nov 30 2016 00:15
@gikwu1 [ { ... } , { ... } ] You're missing a ,
gabi
@gikwu1
Nov 30 2016 00:15
ok
Diego Mayer
@Chrono79
Nov 30 2016 00:16
@revisualize party pooper :P
gabi
@gikwu1
Nov 30 2016 00:16
a ,
Joseph
@revisualize
Nov 30 2016 00:16
@Chrono79 I know right. :P
Diego Mayer
@Chrono79
Nov 30 2016 00:16
add it between the 2 objects
Joseph
@revisualize
Nov 30 2016 00:16
@Chrono79 But, you know.. Reading. People do it.
David Amanze
@GodKingShogun
Nov 30 2016 00:17
has anyone familiar with the card counting problem in javascript
so grammatically wrong but you get my gist
Diego Mayer
@Chrono79
Nov 30 2016 00:19
@GodKingShogun Have you written some code?
David Amanze
@GodKingShogun
Nov 30 2016 00:20
i've hypothesized how to go about it but i haven't written any code on the problem
Diego Mayer
@Chrono79
Nov 30 2016 00:20
@GodKingShogun ok, then let's hear/read what you think you have to do
David Amanze
@GodKingShogun
Nov 30 2016 00:20
do you recommend using the if/else statements or the switch statement on that problem
Diego Mayer
@Chrono79
Nov 30 2016 00:21
either way is fine, I used if/else
gabi
@gikwu1
Nov 30 2016 00:23
@Chrono79 thanks
CamperBot
@camperbot
Nov 30 2016 00:23
:star2: 2674 | @chrono79 |http://www.freecodecamp.com/chrono79
gikwu1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Nov 30 2016 00:23
no problem
David Amanze
@GodKingShogun
Nov 30 2016 00:23
if im using the switch statement i would assign each card a case and give it a value of +1,0,-1 depending on what the table says
Diego Mayer
@Chrono79
Nov 30 2016 00:24
@GodKingShogun you should change count value following that table
David Amanze
@GodKingShogun
Nov 30 2016 00:25
i understand that
Diego Mayer
@Chrono79
Nov 30 2016 00:25
ok, what will you do next?
David Amanze
@GodKingShogun
Nov 30 2016 00:25
can you do an example of how i would do the first set of cards from 2 to 6
im not sure what to do next
also the return step is confusing for me
Diego Mayer
@Chrono79
Nov 30 2016 00:26
switch(card) {
case 2:
case 3:
...
case 6:
count++;
break;
...
You have to evaluate count after that and return count new value plus Hold or Bet following the instructions. Don't mix card evaluation with count evaluation (where you return), one goes after the other
Try to write some code now and come back if you get stuck
David Amanze
@GodKingShogun
Nov 30 2016 00:29
so how would you write the return count evaluation
Diego Mayer
@Chrono79
Nov 30 2016 00:29
with an if/else (enough hints, try writing some code)
David Amanze
@GodKingShogun
Nov 30 2016 00:30
so the problem requires you to use switch and if/else statements
Diego Mayer
@Chrono79
Nov 30 2016 00:30
@GodKingShogun or 2 if/else blocks, yes
Doug
@doug20000
Nov 30 2016 00:31
I'm on the check longest word challenge and my code makes sense in my head but it's not working in practice. anyone able to give me a hint of where I should take this?

function findLongestWord(str) {
var myArr = str.split(" ");
var longestWord = 0;

for (i = 0; i < myArr.length; i++) {
wordLength = function () {
if ([i].length > longestWord) {
longestWord = [i].length;
}

};
}

return longestWord;
}

findLongestWord("The quick");
David Amanze
@GodKingShogun
Nov 30 2016 00:32
ok let me try writing a few strands of code to see if i am on the right track
Diego Mayer
@Chrono79
Nov 30 2016 00:36
@doug20000 what is wordLength function for and where are you calling it?
[i].length is 1, you need your array name before the brackets to refer to some element of your array
Doug
@doug20000
Nov 30 2016 00:37
the function is meant to measure the length of each word in the array per loop. If the word length is longer than the previous ones it records a new length for the longestWord var
would it be better to have the function outside the loop, and have the loop call it each time?
Diego Mayer
@Chrono79
Nov 30 2016 00:38
@doug20000 better get rid of the function and leave the if inside the loop, fix what I told you before about [i]
Doug
@doug20000
Nov 30 2016 00:41
@Chrono79 ok, in my testing i did see that [i].length is equalling 1, how to i make the loop send back the length of the particular word it's on?
Diego Mayer
@Chrono79
Nov 30 2016 00:41
myArr[i].length
Doug
@doug20000
Nov 30 2016 00:41
doh! yes of course
brain fart
Diego Mayer
@Chrono79
Nov 30 2016 00:42
:+1:
djbrigidope
@djbrigidope
Nov 30 2016 00:42

high there: ,ale objects private: var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

this.getSpeed = function() {
return speed;
};
};

var Bike = function() {

// Only change code below this line.
var gear = 6;

this.setGear = function(change) {
gear += change;
};

this.getGear = function() {
gear += change;
};

};

var myCar = new Car();

var myBike = new Bike(); //send halp

Doug
@doug20000
Nov 30 2016 00:42
@Chrono79 thanks, i think that should get me on my way now :D
CamperBot
@camperbot
Nov 30 2016 00:42
doug20000 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2675 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 30 2016 00:43
@djbrigidope it's setGear, not incrementGear (you're not using the right math operator there). And getGear should retirn gear, not change its value
David Amanze
@GodKingShogun
Nov 30 2016 00:44
@Chrono79 so ++ shows increment of 1 but how would you write the value of no increment for 7,8,9 switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 7:
case 8:
case 9:
count;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
}
Diego Mayer
@Chrono79
Nov 30 2016 00:45
@GodKingShogun you could simply ommit them
David Amanze
@GodKingShogun
Nov 30 2016 00:46
ok. on to the second switch statement. would i start it after the closed bracket and then title that switch cc
for card count
Diego Mayer
@Chrono79
Nov 30 2016 00:47
@GodKingShogun I wouldn't use another switch
David Amanze
@GodKingShogun
Nov 30 2016 00:47
why not
Diego Mayer
@Chrono79
Nov 30 2016 00:47
I'll be afk for a while
because you have to use unequalities with count
and switch is used against values using ===
David Amanze
@GodKingShogun
Nov 30 2016 00:49
so use an if/else statement for cc after the closed bracket for card switch
Tmgorgeous11
@Tmgorgeous11
Nov 30 2016 00:55
how do i use ++ operator
to increment a number
Diego Mayer
@Chrono79
Nov 30 2016 00:56
@Tmgorgeous11 like the example code with i
i = i +1; is the same as i++;
@GodKingShogun you should evaluate count with the if/else, cc is your function name
David Amanze
@GodKingShogun
Nov 30 2016 01:02
this is what i have so far
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
}
if (count>0) {
result= count "Bet";
}
Diego Mayer
@Chrono79
Nov 30 2016 01:03
@GodKingShogun https://www.freecodecamp.com/challenges/constructing-strings-with-variables
or https://www.freecodecamp.com/challenges/concatenating-strings-with-plus-operator
You have to use string concatenation to get the right answer
Also, you could return directly instead of using a var to store the string
David Amanze
@GodKingShogun
Nov 30 2016 01:08
thank you so much @Chrono79 . i got it finally. my brain is so fried now. ill have to come back and definitely revisit this problem next time i get back on here
CamperBot
@camperbot
Nov 30 2016 01:08
godkingshogun sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2676 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 30 2016 01:10
:+1:
Stephen Kilgore
@devninja89
Nov 30 2016 01:11
Anyone here familiar with React? How do I pass a method from my root component to one of its child components to run?
David Halls
@DavidHalls
Nov 30 2016 01:13
Diego Mayer
@Chrono79
Nov 30 2016 01:16
@Byzgig if you click some cell already used (either by you or by the computer) it breaks, you should make the already used cells disabled to click
David Halls
@DavidHalls
Nov 30 2016 01:18
@Chrono79 thanks, i think i know what broke that, i added a step to disable the buttons when it is the AI move, ill look into that
CamperBot
@camperbot
Nov 30 2016 01:18
byzgig sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2677 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 30 2016 01:18
:+1:
Doneal Bercier
@donealbercier
Nov 30 2016 01:21
Can anyone help me understand the Seek and Destroy challenge. I'm having trouble understanding how to use arguments in filter method
Diego Mayer
@Chrono79
Nov 30 2016 01:21
@donealbercier show your code, arguments objects is function dependant, that is, the arguments object inside your function is not the same as the one inside the filter function
Doneal Bercier
@donealbercier
Nov 30 2016 01:23

'''

function filter(val,notGood){

var newVar = false;

for(var i = 0; i<notGood.length; i++){

if(val == notGood[i]){
newVar = true;
}
}

if(newVar === false){
return val;
}
}

function destroyer(arr) {
var newArr = arguments[0];
var notGood = [];
for(var i = 1; i<arguments.length;i++){

notGood.push(arguments[i]);

}

newArr =newArr.filter(filter);
return newArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
'''

CamperBot
@camperbot
Nov 30 2016 01:23
:bulb: to format code use backticks!  more info
Doneal Bercier
@donealbercier
Nov 30 2016 01:23
This is what I have so far but I'm still confused
Diego Mayer
@Chrono79
Nov 30 2016 01:23

access them using arguments object and if you want make an array with them
notGood there is 2, not an array

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
arguments[0] is [1, 2, 3, 1, 2, 3] //that's arr btw
arguments[1] is 2
arguments[2] is 3

newArr is the same as arr in your code

Doneal Bercier
@donealbercier
Nov 30 2016 01:26
I understand that the arguments itself are apart of the arguments object. But how would I use them in the filter function I can't seem to access them
Jan
@burning-monk
Nov 30 2016 01:27
@donealbercier do you understand this? https://jsbin.com/luposef/edit?js,console
Diego Mayer
@Chrono79
Nov 30 2016 01:28
@donealbercier write you filter function inside destroyer and access the arguments using notGood (I've seen you've built an array with the arguments)
Doneal Bercier
@donealbercier
Nov 30 2016 01:29
@burning-monk Yes I understand how the filter function works here.
Diego Mayer
@Chrono79
Nov 30 2016 01:29
Doneal Bercier
@donealbercier
Nov 30 2016 01:29
@Chrono79 That makes alot of sense thank you. I'll try that now
Jan
@burning-monk
Nov 30 2016 01:29
but? @donealbercier
CamperBot
@camperbot
Nov 30 2016 01:29
donealbercier sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2678 | @chrono79 |http://www.freecodecamp.com/chrono79
Doneal Bercier
@donealbercier
Nov 30 2016 01:29
@burning-monk my problem was with accessing the parameters inside of the filter function
Diego Mayer
@Chrono79
Nov 30 2016 01:32

@donealbercier the second parameter of you filter method is what you call this inside the function, it's used like this:

newArr = newArr.filter(filter, notGood); //thisArg Optional. Value to use as this when executing callback.

function filter(val){
var newVar = false;
for(var i = 0; i<this.length; i++){ //this here is notGood array
if(val == this[i]){
newVar = true;
}
}
if(newVar === false){
return val;
}
}

This is another way of doing it, leaving your filter function outside (if you want) like you had before

claygoldman
@claygoldman
Nov 30 2016 01:33
Can anybody help with the one that has "Firstline, \Secondline\, Thirdline>?
Joseph
@revisualize
Nov 30 2016 01:34
@claygoldman Sure, What should the string be without the escaped characters?
cbot
CamperBot
@camperbot
Nov 30 2016 01:35
you called?
claygoldman
@claygoldman
Nov 30 2016 01:35
I'm not sure
Sorry Im new to this
Doneal Bercier
@donealbercier
Nov 30 2016 01:35
@Chrono79 I think I understand now. I'm going to move the function now
Joseph
@revisualize
Nov 30 2016 01:35
@claygoldman It's in the instructions.
claygoldman
@claygoldman
Nov 30 2016 01:36
Oh, I wasnt sure if that was it sorry
Joseph
@revisualize
Nov 30 2016 01:36
@claygoldman What is that full text without the escaped characters.
Diego Mayer
@Chrono79
Nov 30 2016 01:37
@claygoldman look at the last line of the instructions
claygoldman
@claygoldman
Nov 30 2016 01:37
I see it. Do you want me to put it on here how its written there
Joseph
@revisualize
Nov 30 2016 01:38
@claygoldman Come on...

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

Run tests (ctrl + enter)

@claygoldman Right?
claygoldman
@claygoldman
Nov 30 2016 01:38
ya
Joseph
@revisualize
Nov 30 2016 01:39
@claygoldman Great. How do you escape a newline?
claygoldman
@claygoldman
Nov 30 2016 01:39
I figured it out. Thank you
Joseph
@revisualize
Nov 30 2016 01:40
Great.
Joseph
@revisualize
Nov 30 2016 01:45
la la la la
c0d0er
@c0d0er
Nov 30 2016 01:48
@toianw thanks
CamperBot
@camperbot
Nov 30 2016 01:48
c0d0er sends brownie points to @toianw :sparkles: :thumbsup: :sparkles:
jump020305
@jump020305
Nov 30 2016 01:52
I am trying to add br tag between the text in react.
can you guys tell me how to add it.
I tried adding br tag... but if I add I get <br> tag in the browser.
providng my code below.
can you guys tell me how to fix it.
let sportsDescription = '';

if(sportsInfo !== '' && !isSportsSetupActive) {
sportsDescription = 'testing <br /> testing';

}else if(isSportsSetupActive) {
sportsDescription = 'testing <br /> testing';

}

return (
<div id="main" className="section flex-container flex-full">
<section className="page-content flex-item">
<section className="gray-box">
<p className="ft-intro ft-day1 ft-day2">{sportsDescription}</p>

</section>
</section>
</div>
);
Ramone
@RamoneQR
Nov 30 2016 01:52
I also need help with the escape section... I am confused
var myStr = "FirstLine\n'\SecondLine'\'ThirdLine'\r"; // Change this line I am not sure what I am doing wrong
Moisés Man
@moigithub
Nov 30 2016 01:56
Stephen James
@sjames1958gm
Nov 30 2016 02:12
@RamoneQR You need to only replace the 4 keywords with the escape sequences - they all go either side of SecondLine
no ' are needed within the string
Aarya Bhorra
@aarya1302
Nov 30 2016 02:15
function countSumOfTwoRepresentations2(n, l, r) {
var array = [];
var count = 0;
for (var i = l; i <= r; i++){
for(var j = i; j <= r; j++){
if(j + i === n){count++}
}
}
return count;
}
I was wondering if any of you guys can give me pointers to make it more efficient
Margaret
@Margaret2
Nov 30 2016 02:15
@aarya1302 what is the point of the array?
it looks like you are not using it
Aarya Bhorra
@aarya1302
Nov 30 2016 02:18
Ohh yeah I forgot to take it out
But the code is still not very efficient
Zapp_Brannigan
@dggz93
Nov 30 2016 02:20
in the contacts exercise, how can i do to read all the array?
for(var i = 0; i <= contacts.length; i++)
{
if(contacts[i].firstName == firstName)
{
      }
}
Margaret
@Margaret2
Nov 30 2016 02:20
@aarya1302 so basically you are trying to find how many pairs of numbers in the range l to r add up to equal n?
Zapp_Brannigan
@dggz93
Nov 30 2016 02:20
because when i use the return statement stops
Aarya Bhorra
@aarya1302
Nov 30 2016 02:20
yes
Margaret
@Margaret2
Nov 30 2016 02:21
cool puzzle, I'll think about it and let you know if i come up with anything @aarya1302
Johnny
@JohnnyBizzel
Nov 30 2016 02:21
@dggz93 Do you need to return inside a loop?
Aarya Bhorra
@aarya1302
Nov 30 2016 02:21
@Margaret2 ok
@dggz93 Yess because once you use return the rest of your code won't execute
Zapp_Brannigan
@dggz93
Nov 30 2016 02:22
seems like that
then what? console.log don't work neither
Johnny
@JohnnyBizzel
Nov 30 2016 02:23
Zapp_Brannigan
@dggz93
Nov 30 2016 02:23
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i <= contacts.length; i++)
{
if(contacts[i].firstName == firstName)
{
return firstName;
}
else
{
return "No such contact";
}
}
// Only change code above this line
}
Aarya Bhorra
@aarya1302
Nov 30 2016 02:24
@dggz93 What exercise is that?
Zapp_Brannigan
@dggz93
Nov 30 2016 02:24
Profile Lookup
Johnny
@JohnnyBizzel
Nov 30 2016 02:24
@dggz93 You are not using "prop" at all. Use .hasOwnProperty() function
Walid Ashri
@walidashri
Nov 30 2016 02:25
Hi all need help with this react Please code pen link line 22 has the issue description
Zapp_Brannigan
@dggz93
Nov 30 2016 02:25
always forget the hasOwnProperty()...i'll try, thanks
Walid Ashri
@walidashri
Nov 30 2016 02:27
@moigithub @sjames1958gm Please :point_up: November 30, 2016 6:25 AM
Alain
@apjunior770
Nov 30 2016 02:27
Hello :D does anyone here a free begginers java ebook?
Alain
@apjunior770
Nov 30 2016 02:30
thank you @JohnnyBizzel
CamperBot
@camperbot
Nov 30 2016 02:30
apjunior770 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Zapp_Brannigan
@dggz93
Nov 30 2016 02:34
if(contacts[i].firstName == firstName)
{
if(contacts[i].hasOwnProperty(prop))
{
return contacts[i][prop];
}
else
{
return "No such property";
}
}
almost done, but if i do a else return "No such contact"
stop the loop
Diego Mayer
@Chrono79
Nov 30 2016 02:36
@dggz93 then don't do it there, think about when you can say for sure the contact you look for is not in the contact list
Margaret
@Margaret2
Nov 30 2016 02:37
@aarya1302
function count(total, min, max){
var count = 0;
for (var i = min; i<=max;i++){
if (total-i <= max){count++;}
}
return count;
}
i changed the names a little
agusprieto
@agusprieto
Nov 30 2016 02:39
@dggz93 try relocating the return "No such contact" outside the loop
Zapp_Brannigan
@dggz93
Nov 30 2016 02:42
don't work
Diego Mayer
@Chrono79
Nov 30 2016 02:43
@dggz93 paste the whole function and format the code following the more info instructions
CamperBot
@camperbot
Nov 30 2016 02:43
:bulb: to format code use backticks!  more info
agusprieto
@agusprieto
Nov 30 2016 02:46
@dggz93 if you put the return "No such contact" inside the for loop it wont work as you already tried. So try writting the return outside the for loop
Johnny
@JohnnyBizzel
Nov 30 2016 02:46
@walidashri I see you are not using LocalStorage.
Aarya Bhorra
@aarya1302
Nov 30 2016 02:47
@Margaret2 Can you explain your code to me?
agusprieto
@agusprieto
Nov 30 2016 02:48
@agusprieto cause if you leave the return "No such contact" inside the loop is going to return that value before checking the rest of the array
@Chrono79 Diego can you give me a hand understanding something

var oldArray = [1,2,3,4,5];

// Only change code below this line.

var newArray = oldArray.map(function (values){
return  values + 3;
}) ;
Diego Mayer
@Chrono79
Nov 30 2016 02:50
@agusprieto what is it?
Zapp_Brannigan
@dggz93
Nov 30 2016 02:50
i tried to put it outside the loop
agusprieto
@agusprieto
Nov 30 2016 02:50
when i write function and the (), what does it means what i put inside the parenthesis
Manish Giri
@Manish-Giri
Nov 30 2016 02:50
@agusprieto those are the "arguments" you pass into your function
agusprieto
@agusprieto
Nov 30 2016 02:51
@dggz93 show us the code
Ramone
@RamoneQR
Nov 30 2016 02:51
@sjames1958gm Okay thanks I was really confused
CamperBot
@camperbot
Nov 30 2016 02:51
ramoneqr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4611 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
agusprieto
@agusprieto
Nov 30 2016 02:51
i do know those are arguments but i am not getting in this case what are doing those arguments
Diego Mayer
@Chrono79
Nov 30 2016 02:51
@agusprieto values is each element of the array you're calling map with
map returns a new array with your elements modified usinf the function you wrote
Zapp_Brannigan
@dggz93
Nov 30 2016 02:52
for(var 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";
Diego Mayer
@Chrono79
Nov 30 2016 02:52
Margaret
@Margaret2
Nov 30 2016 02:53
@aarya1302 basically there is no need to go through the range of numbers twice
• let's say total = 5, min = 1, and max = 3
• for all the numbers in the range 1 to 3, if the number needed to make 5 is also in the range 1 to 3, then we have a pair
• so for each number we just need to find the number to add that will make 5:
total-i
• and if that number is within the range 1 to 3, then we have a valid pair
• so there will be 2 pairs: 2+3 and 3+2
Danny Mendez
@DannyMendez
Nov 30 2016 02:53
So idk if my brain is just fried or what but I'm stuck on the nextInLine function
Margaret
@Margaret2
Nov 30 2016 02:54
@DannyMendez have you tried anything so far?
Danny Mendez
@DannyMendez
Nov 30 2016 02:54
nothing with any success
Diego Mayer
@Chrono79
Nov 30 2016 02:54
@DannyMendez yes, review pop, push, shift and unshift, how they work, what they returns, etc,
Zapp_Brannigan
@dggz93
Nov 30 2016 02:54
for(var 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";
...
Diego Mayer
@Chrono79
Nov 30 2016 02:54
@dggz93 <= contacts.length is wrong, it should be < contacts.length
Rex Smith Jr.
@rsmith731
Nov 30 2016 02:54
can someone help me with an issue?
Zapp_Brannigan
@dggz93
Nov 30 2016 02:54
before send looks better
Danny Mendez
@DannyMendez
Nov 30 2016 02:55
@Chrono79 uhhh!!! DUHHHH! lol thank you so much!
CamperBot
@camperbot
Nov 30 2016 02:55
dannymendez sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2679 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 30 2016 02:55
js

Zapp_Brannigan
@dggz93
Nov 30 2016 02:56
an stupid fail, typical
thank you guys
Margaret
@Margaret2
Nov 30 2016 02:56
@DannyMendez you have to do two things:
• add a number to the array. You can do this with .push()
• remove the first number from the array and return it. You can do this with .shift()
Diego Mayer
@Chrono79
Nov 30 2016 02:56
@dggz93 that's how you format the code in the chat, try it
Danny Mendez
@DannyMendez
Nov 30 2016 02:56
@Margaret2 Thank you!!!
CamperBot
@camperbot
Nov 30 2016 02:56
dannymendez sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
agusprieto
@agusprieto
Nov 30 2016 02:56
@dggz93 haha been there a thousand times
Aarya Bhorra
@aarya1302
Nov 30 2016 02:57
@Margaret2 thanks
CamperBot
@camperbot
Nov 30 2016 02:57
aarya1302 sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
Aarya Bhorra
@aarya1302
Nov 30 2016 02:57
I'll try the code
Zapp_Brannigan
@dggz93
Nov 30 2016 02:58
by the way, the brownie points, what for?
Margaret
@Margaret2
Nov 30 2016 02:58
@dggz93 for fun :D
Diego Mayer
@Chrono79
Nov 30 2016 02:58
1 brownie 1 dollar (I wish) I can sell you some if you want wink wink :P
Margaret
@Margaret2
Nov 30 2016 03:00
@Chrono79 :joy:
it could be like stack overflow where we could give out bounties
Zapp_Brannigan
@dggz93
Nov 30 2016 03:00
hahaha
i want brownie points for no reason, i'll begin to help
agusprieto
@agusprieto
Nov 30 2016 03:07
@dggz93 tnanks
@dggz93 thanks
CamperBot
@camperbot
Nov 30 2016 03:08
agusprieto sends brownie points to @dggz93 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dggz93
agusprieto
@agusprieto
Nov 30 2016 03:08
there you go ! haha
Aravinda
@bhat01
Nov 30 2016 03:09
??
Danny Mendez
@DannyMendez
Nov 30 2016 03:09
So....still having trouble with this next in line function
Margaret
@Margaret2
Nov 30 2016 03:10
@dggz93 thanks
Danny Mendez
@DannyMendez
Nov 30 2016 03:10
function nextInLine(arr, item) { // Your code here var removed = arr.shift(); arr.shift(); arr.push(item); return removed; // Change this line }
Margaret
@Margaret2
Nov 30 2016 03:10
@dggz93 thanks
CamperBot
@camperbot
Nov 30 2016 03:10
margaret2 sends brownie points to @dggz93 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dggz93
Margaret
@Margaret2
Nov 30 2016 03:10
Zapp_Brannigan
@dggz93
Nov 30 2016 03:10
Margaret
@Margaret2
Nov 30 2016 03:10
@DannyMendez do not call arr.shift() twice
@dggz93 are you a new github user?
Zapp_Brannigan
@dggz93
Nov 30 2016 03:11
yep
Margaret
@Margaret2
Nov 30 2016 03:11
@dggz93 then it probably has something to do with that, sometimes if you are new or inactive, it takes a while to resolve for some reason
it happened to me at first
Aravinda
@bhat01
Nov 30 2016 03:12
@bhat01 how to solve?
Margaret
@Margaret2
Nov 30 2016 03:12
@DannyMendez arr.shift() both removes the item and returns the removed item automatically, so you only need it once
Aravinda
@bhat01
Nov 30 2016 03:13
Zapp_Brannigan
@dggz93
Nov 30 2016 03:13
well, i expect my brownie points when they find receiver
Danny Mendez
@DannyMendez
Nov 30 2016 03:13
@Margaret2 So I don’t need to assign it to a variable first>
Margaret
@Margaret2
Nov 30 2016 03:14
@DannyMendez no, not really, but you still need to return it
with a return statement
i mean you don't need to return a removed variable, just return arr.shift();
@DannyMendez
Danny Mendez
@DannyMendez
Nov 30 2016 03:16
OHHHHHHH I think I got it now
Margaret
@Margaret2
Nov 30 2016 03:16
@dggz93 :D
Joseph
@revisualize
Nov 30 2016 03:19
@dggz93 That won't happen.
comaeternal
@comaeternal
Nov 30 2016 03:19
function getIndexToIns(arr, num) {
var args = Array.from(arguments);
var x = arr.sort();
for (var i = 0; i < x.length; i++) {
if (x[i] >= num) {
return args[0].indexOf(x[i]);
}
// First order "arr" from smallest to greatest. Then loop through arr looking to see if num
// is less than the greatest index. If it is then return the greatest index

}
}

getIndexToIns([3, 3, 5, 20], 5);
I want this to return 2, but I don't know what I'm doing wrong
Margaret
@Margaret2
Nov 30 2016 03:19
@revisualize aww, don't burst his bubble :)
Joseph
@revisualize
Nov 30 2016 03:20
@DannyMendez You're doing things out of order.
Danny Mendez
@DannyMendez
Nov 30 2016 03:20
@revisualize So push first then shift?
Zapp_Brannigan
@dggz93
Nov 30 2016 03:20
:(
Joseph
@revisualize
Nov 30 2016 03:20
@DannyMendez Yes. As per the instructions.
@dggz93 Then when someone thanks you ... You'll get your brownie points.
CamperBot
@camperbot
Nov 30 2016 03:21
revisualize sends brownie points to @dggz93 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dggz93
Joseph
@revisualize
Nov 30 2016 03:21
But, until then.
No brownies for you.
Doug
@doug20000
Nov 30 2016 03:21

having trouble with Title Class a Sentence

function titleCase(str) {

var myArr = str.toLowerCase().split(" ");
for (i = 0; i < myArr.length; i++) {
myArr[i][0].toUpperCase(); //Targets the first letter, but wont change case
}
return myArr;

}

titleCase("I'm a little tea pot");

I have a suspicion that .toUpperCase() is not compatable with arrays. If so how else could I change the case?

Emily Ann
@emilyaringoen
Nov 30 2016 03:22
Hey, I'm having a little trouble with the challenge "Check for Palindromes". Here is what I have so far:
Zapp_Brannigan
@dggz93
Nov 30 2016 03:22
solved, you can send me my missed brownies
Emily Ann
@emilyaringoen
Nov 30 2016 03:24
Hey, I'm having a little trouble with the challenge "Check for Palindromes". Here is what I have so far:

function palindrome(str) {
// Good luck!
var otherWay = str
.toLowerCase()
.replace(/[^a-z0-9+]+/gi, '')
.split('')
.reverse()
.join('');
if (otherWay === str) {
return true;
}
}

palindrome("eye");
Margaret
@Margaret2
Nov 30 2016 03:24
@comaeternal just push the num into the array, don't use Array.from. You also don't need a for loop, just use indexOf(), i think
@emilyaringoen try taking out the +'s from the regex
LPR-309
@LPR-309
Nov 30 2016 03:26
@doug20000 Hey doug, I think that should be working because you're targeting the string (or the first letter of the string) inside the arrays. Try myArr[i][0] = myArr[i][0].toUpperCase(); , I don't think it's getting assigned.
Danny Mendez
@DannyMendez
Nov 30 2016 03:26
Thanks @revisualize and @Margaret2, I was making that way harder than it needed to be.
CamperBot
@camperbot
Nov 30 2016 03:26
dannymendez sends brownie points to @revisualize and @margaret2 :sparkles: :thumbsup: :sparkles:
:warning: dannymendez already gave margaret2 points
:star2: 2434 | @revisualize |http://www.freecodecamp.com/revisualize
Diego Mayer
@Chrono79
Nov 30 2016 03:27
@emilyaringoen str contains capital letters, spaces and punctuation symbols, they're not comparable (I meant str and otherWay)
Margaret
@Margaret2
Nov 30 2016 03:27
@emilyaringoen and if that doesn't work, it may be because you need to split up the methods instead of having them all in one long chain. toLowerCase and replace are string methods, but reverse and join are array methods
and what he said ^^
Doug
@doug20000
Nov 30 2016 03:28
@LPR-309 I get the error : "type error: 0 is read only" when i do this
Diego Mayer
@Chrono79
Nov 30 2016 03:30
@emilyaringoen instead of doing it all in a long chain, store the result of lowercasing and replacing in one var, and compare that one with its reversed version
Emily Ann
@emilyaringoen
Nov 30 2016 03:31
function palindrome(str) {
// Good luck!
var original = str
.toLowerCase()
.replace(/[^a-z0-9+]+/gi, '');
var otherWay = str
.toLowerCase()
.replace(/[^a-z0-9+]+/gi, '')
.split('')
.reverse()
.join('');
if (original === otherWay) {
return true;
}
}

palindrome("eye");
@Chrono79 does that look better?
Micah Lewis
@EastML
Nov 30 2016 03:33
Having a bit of trouble. Doing the LCM challenge and I don't see why my code returns the wrong answer. Anyone see any problems?
function smallestCommons(arr) {
var sorted = arr.sort(function(a,b) {
return a - b;
});

var min = sorted[0];
var max = sorted[1];
var lcm = 1;

while(true) {
for (var i = min; i < max; i++) {
if ((max * lcm) % i !== 0) {
lcm++;
}
}
return max * lcm;
}
}

smallestCommons([1, 13]);
LPR-309
@LPR-309
Nov 30 2016 03:34
@doug20000 I ended up assigning the first letter to a 'temp' variable, uppercasing that, and reassigning it back into the array to get around that. But I also split each word into an array of letters. I'm sure there's a more efficient solution.
Diego Mayer
@Chrono79
Nov 30 2016 03:34
@emilyaringoen yes, but you could use original instead of str when creating otherWay value to keep your code DRY
You can delete the + from your regex too and simply return original === otherWay; <- that's a boolean
Emily Ann
@emilyaringoen
Nov 30 2016 03:35
@Chrono79 Alright! Thanks that worked.
CamperBot
@camperbot
Nov 30 2016 03:35
emilyaringoen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2680 | @chrono79 |http://www.freecodecamp.com/chrono79
Margaret
@Margaret2
Nov 30 2016 03:35
@doug20000 it must be because you can't just change one part of an item in an array, you have to change the whole item. Try using substring, something like this:
a[0] = (a[0][0].toUpperCase() + a[0].substring(1));
agusprieto
@agusprieto
Nov 30 2016 03:35


function reverseString(str) {
var stringSplit = str.split('');
var stringReverse = stringSplit.reverse();
var stringJoin = stringReverse.join('');
return stringJoin;
}

reverseString("hello");
Doug
@doug20000
Nov 30 2016 03:35
@LPR-309 i thought of that, but also figured there must be another way. thanks for you insight :)
CamperBot
@camperbot
Nov 30 2016 03:35
doug20000 sends brownie points to @lpr-309 :sparkles: :thumbsup: :sparkles:
agusprieto
@agusprieto
Nov 30 2016 03:36
@Chrono79 Diego i think the way i did it is not the easiest, is there an other way ?
Diego Mayer
@Chrono79
Nov 30 2016 03:36
@agusprieto you could chain methods
agusprieto
@agusprieto
Nov 30 2016 03:36
how can i do that
Diego Mayer
@Chrono79
Nov 30 2016 03:37
function reverseString(str) {
return str.split('').reverse().join('');
}
Doug
@doug20000
Nov 30 2016 03:37
@Margaret2 I'm a little confused by how to impliment this. Are you suggesting a second for loop in the loop or..?
agusprieto
@agusprieto
Nov 30 2016 03:38
@Chrono79 thanks ! i knew there was an easier way to do it
CamperBot
@camperbot
Nov 30 2016 03:38
agusprieto sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2681 | @chrono79 |http://www.freecodecamp.com/chrono79
Margaret
@Margaret2
Nov 30 2016 03:38
@doug20000 no, i just meant replace the line where you try to uppercase the letter with my line
using i of course
Diego Mayer
@Chrono79
Nov 30 2016 03:39
@agusprieto not all methods are chainable (does that word even exist?)
Margaret
@Margaret2
Nov 30 2016 03:39
a[i] = (a[i][0].toUpperCase() + a[i].substring(1)); @doug20000
Diego Mayer
@Chrono79
Nov 30 2016 03:40
I'll hit the sack, happy coding folks
Margaret
@Margaret2
Nov 30 2016 03:40
@Chrono79 sleep well :stars:
Doug
@doug20000
Nov 30 2016 03:40
@Margaret2 I'll have another play around with that and let you know how I get on :) cheers
Margaret
@Margaret2
Nov 30 2016 03:41
@doug20000 :+1:
Aiden
Nov 30 2016 03:42
Hey folks!
Margaret
@Margaret2
Nov 30 2016 03:43
i have to go too though, work starts early for me :sunrise: , night all
Aiden
Nov 30 2016 03:45
I'm working on a personal portfolio site, and I'm trying to do an image carousel using bootstrap. I'm having an issue with the buttons not working. I've scoured stackoverflow, tried updating the various things that they suggest, checking the order of my library links, and I just cannot get it to work. I even went to a working codepen that I made, and stole the library links from that (also where I copied my code from and just scaled it up for more photos, and changed some id names). But nothing I do seems to work. Anyone willing to check it out?
I can post my code here, but it's written in brackets, so I can't post a link to it.
c0d0er
@c0d0er
Nov 30 2016 03:50
@toianw thanks!
CamperBot
@camperbot
Nov 30 2016 03:50
c0d0er sends brownie points to @toianw :sparkles: :thumbsup: :sparkles:
tfbm89
@tfbm89
Nov 30 2016 03:51
good nigth friends
Doug
@doug20000
Nov 30 2016 04:10
@Margaret2 I had another go and I'm really close thanks to you! Though my code seems to pass my tests it's not being accepted:
 
CamperBot
@camperbot
Nov 30 2016 04:10
doug20000 sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
Doug
@doug20000
Nov 30 2016 04:10
@Margaret2
function titleCase(str) {

var newStr = "";
var myArr = str.toLowerCase().split(" ");
for (i = 0; i < myArr.length; i++) {
newStr += (myArr[i][0].toUpperCase() + myArr[i].substring(1, 25) + " ");
}
return newStr;
}

titleCase("i'M A litTLe TEa PoT");
shubhankarb180
@shubhankarb180
Nov 30 2016 04:14
Hello Everyone .. I am Shubhankar from india and have just started on free code camp and hope learn something new soon.
Nov 30 2016 04:16
const titleCase = str => str.toLowerCase()
.split(' ')
.map(w => w[0].toUpperCase()+w.substr(1))
.join(' ');

titleCase("i'M A litTLe TEa PoT");
silver537
@silver537
Nov 30 2016 04:41
HELLO WORLD
CamperBot
@camperbot
Nov 30 2016 04:41

## welcome to FreeCodeCamp @silver537!

Jordan Shackelford
@JordanShackelford
Nov 30 2016 04:55
anybody know how a computer could connect to my node.js server from the internet?
John
@johngunderson1
Nov 30 2016 04:58
is anyone proficient at the counting cards exercise?
i have most of the coding down right, i just cant get the card values to add together
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:00
@johngunderson1 can you show what you've done?
John
@johngunderson1
Nov 30 2016 05:00

var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count = 1;
break;
case 7:
case 8:
case 9:
count = 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count = -1;
}
if (count >= 1) {
return count + " Bet";
}
else return count + " Hold";

// Only change code above this line
}

// Note: Only the last will display
cc(10); cc("J"); cc("Q"); cc("K"); cc("A");

Ogundele Olumide
@Lumexralph
Nov 30 2016 05:01
@johngunderson1 your decrement and increment operation is not correct
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 05:01
i need help html
John
@johngunderson1
Nov 30 2016 05:01
i figured that was it
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:01
you either increase by 1 or decrease by 1
John
@johngunderson1
Nov 30 2016 05:01
i'll have to study that section some more
thanks for the help @Lumexralph
CamperBot
@camperbot
Nov 30 2016 05:02
johngunderson1 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:02
count ++ or count - -
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 05:02

whats wrong with my code im getting an error on my console at my else statement:

var length=96
var diameter=74

document.getElementById("myButton").onclick = function(){

} else  {

}

}
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:03
@mtpjr88 your if statement Where's the first curly bracket?
@mtpjr88 you also don't need the parenthesis wrapped around length, seems redundant
@mtpjr88 your semicolon terminates that if statement you might want to remove that also
Nov 30 2016 05:08
Hey everyone. I was wondering if someone could explain this. By running the code below I was expecting “true” as the result, but instead get false. Anyone know why?
var status = false; console.log(!status);
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 05:11
@Lumexralph the first curly bracket is after the function
Saiduk
@Saiduk
Nov 30 2016 05:16
No idea why this is happening... :( The characters don't want to match up to the numbers, and the spaces in between are red dots.
function rot13(str) { // LBH QVQ VG!
var numbered = [];
for (var i = 0; i < str.length; i++) {
numbered.push(str.charCodeAt(i));
numbered[i] -= 13;
numbered[i] = String.fromCharCode(numbered[i]);
}

return numbered.join("");

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Nov 30 2016 05:21
@Saiduk Hey so Im trying to recal back to when I did this. I think you have to check to see if the letter is in the first half of the alphabet or the second half. If its in the first half, you add 13 to numbered[i], if its in the second half you subtract
or something like that
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:21
@mtpjr88 your if statement also needs curly brackets, you had a closing one but omitted the opening bracket
Saiduk
@Saiduk
Nov 30 2016 05:21
@adamakers ah, ok. I'll give it a go. Thanks
CamperBot
@camperbot
Nov 30 2016 05:21
saiduk sends brownie points to @adamakers :sparkles: :thumbsup: :sparkles:
Micah Lewis
@EastML
Nov 30 2016 05:24
Doing the Lowest Common Multiple challenge and my code seems right, but doesn't get the correct answer. Any ideas why?
function smallestCommons(arr) {
var sorted = arr.sort(function(a,b) {
return a-b;
});

var min = sorted[0];
var max = sorted[1];
var lcm = 1;

while(true) {
for(var i = min; i < max; i++) {
if((max * lcm) % i !== 0) {
lcm++;
i = min;
}
}
return max * lcm;
}
}

smallestCommons([18, 23]);
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:25
@adam status is a keyword in Javascript
@adamakers that's the reason for the unusual behavior , you have to use another name for the variable
scketch88
@scketch88
Nov 30 2016 05:27
Anyone able to hep me with "Stand in Line"? Im not sure on what to do here. thank you in advance

function nextInLine(arr, item) {

return item;  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
nextInLine(2, 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
After nextInLine(testArr, 10), testArr[4] should be 10
Alex Nielsen
@bushbass
Nov 30 2016 05:29
mutations algorithms - why doesn't my 'return false' statement need curly braces around it, or more to the point, why does putting curly braces make it pass all the tests except for the first one?
function mutation(arr) {
var second=arr[1].toLowerCase();
var first=arr[0].toLowerCase();

for(i=0;i<second.length;i++){
if(first.indexOf(second[i])<0)
return false;
}
return true;
}
and this my code

// 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 updateRecords(id, prop, value) {

if(prop!=collection[id].tracks){
if(value !== ""){
value= collection[id].album;
}
}
if(prop=="tracks"){
if(collection.id.tracks==False){
collection.id="tracks";    }

}
if(value===""){
delete collection.id.prop;
}
return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
I am facing lots of errors
need help
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:31
@scketch88 you have to push item to arr and use shift to return the first element
scketch88
@scketch88
Nov 30 2016 05:33
@Lumexralph Oh ok. I googled it and saw that but wasnt sure because i havent learned how to use push and shift
@Lumexralph thanks
CamperBot
@camperbot
Nov 30 2016 05:33
scketch88 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:36
@Soumyoahona200 what are the instructions?
Denriquezx
@Denriquezx
Nov 30 2016 05:41
This message was deleted
Eric Bezanson
@ericbezanson
Nov 30 2016 05:43
anyone here that can help me with a quick angular question?
Richard
@richafig
Nov 30 2016 05:44
I need help with convertToF(celsius) Can't figure it out.
Doug
@doug20000
Nov 30 2016 05:44
Is it possible to sort an array with a loop? I'm trying this with no luck.
for (i = 0; i < arr.length; i++) {
arr[i].sort(function(a,b) {
return (a-b);
});
Denriquezx
@Denriquezx
Nov 30 2016 05:44
@richafig Fahrenheit needs to = celcius * 9/5 +32
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 05:45

can someone help

var length=96
var diameter=74

document.getElementById("myButton").onclick = function(){

} else {

}
}

Ogundele Olumide
@Lumexralph
Nov 30 2016 05:45
@doug20000 sorting already loops through the array
Denriquezx
@Denriquezx
Nov 30 2016 05:46
Don't think the 96 should be a string
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:46
@doug20000 using the loop makes sorting to occur at every iteration
Doug
@doug20000
Nov 30 2016 05:46
@Lumexralph oh so in that case the loop is redundant? Would it also work when there are sub arrays ie: [[1,2],[3,4]]...
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:47
@doug20000 exactly
Doug
@doug20000
Nov 30 2016 05:47
@Lumexralph ok thanks, I'll have a try with that!
CamperBot
@camperbot
Nov 30 2016 05:47
doug20000 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Richard
@richafig
Nov 30 2016 05:48
@Denriquezx Thanks!
CamperBot
@camperbot
Nov 30 2016 05:48
richafig sends brownie points to @denriquezx :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:48
@mtpjr88 what type of value are you getting from answer id?
andry91959
@andry91959
Nov 30 2016 05:49
Hi can someone help me how to factorize number

function factorialize(num) {

return num;
}

factorialize(5);

Ogundele Olumide
@Lumexralph
Nov 30 2016 05:50
is it a string or number? if it's a string you'll have to explicitly make it a number and compare it with 96 number and not string
andry91959
@andry91959
Nov 30 2016 05:52
Hi can someone help me how to factorize number using js
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:52
@andry91959 you can use a recursion or a loop that decrements num multiply it with every decrements till num > 0
@andry91959 let's use a loop, the initialization with start at num.... .. for(var i = num; i > 0; i--)
have a global variable let's say result = 1
andry91959
@andry91959
Nov 30 2016 05:54
giv me a sec, ill try
Joseph
@revisualize
Nov 30 2016 05:55
@doug20000 You can sort an array with a loop.
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 05:55
@Lumexralph I am trying to get an alert when i type a number above 96 and a different alert when below 96
Doug
@doug20000
Nov 30 2016 05:55
@revisualize I've been trying but not having much luck
Joseph
@revisualize
Nov 30 2016 05:55
@doug20000 Are you trying to sort a multi-dimensional array?
Doug
@doug20000
Nov 30 2016 05:56
@revisualize correct
Joseph
@revisualize
Nov 30 2016 05:56
@doug20000 How is the data formatted?
@doug20000 What data are you trying to get out?
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:56
in the loop, you'll keep multipying result with every iteration decrement.... result *= i;
Nov 30 2016 05:56
@Lumexralph Thanks man! yea I didn't realize that was a keyword. I should have known.
CamperBot
@camperbot
Nov 30 2016 05:56
adamakers sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:57
then you return result when the loop is done @andry91959
Doug
@doug20000
Nov 30 2016 05:57
@revisualize I'm trying to get the largest number from each array. so my plan is to sort the arrays largest to smallest so then I can filter each number at index 0 to return the numbers
Ogundele Olumide
@Lumexralph
Nov 30 2016 05:58
Joseph
@revisualize
Nov 30 2016 05:58
Do you have.... [ [ 3 , 4 , 8 ] , [ 2 , 7 , 9 ] , [ 1 , 6 , 5] ] and are you trying to get [ [ 1 , 2 , 3 ] , ....
@doug20000 You're just trying to get the largest number from an array?
@doug20000 Math.max
Done.
Doug
@doug20000
Nov 30 2016 05:59
@revisualize the largest number from an array of arrays, correct
Joseph
@revisualize
Nov 30 2016 05:59
@doug20000 Math.max
Done.
Doug
@doug20000
Nov 30 2016 05:59
math.max, + a loop should give me the largest number in each sub array? brilliant!
Joseph
@revisualize
Nov 30 2016 05:59
@doug20000 Yes.
Done.
Doug
@doug20000
Nov 30 2016 05:59
@revisualize way easier than what i've been attempting
Ogundele Olumide
@Lumexralph
Nov 30 2016 06:00
@mtpjr88 what am trying to say is when you get value from an element is it a string or number? use typeof to detect that
Joseph
@revisualize
Nov 30 2016 06:00
@doug20000 I'll take my brownie point and be on my merry way. :P
Saiduk
@Saiduk
Nov 30 2016 06:00
If you uncomment the first part, most of the numbers change, but not all. For example, the 2nd number (69) in the output doesn't change. Why?

function rot13(str) { // LBH QVQ VG!
var numbered = [];
for (var i = 0; i < str.length; i++) {

numbered.push(str.charCodeAt(i));

/*if (numbered[i] >= 65 && numbered[i] <= 77) {
numbered[i] += 13;

}
if (numbered[i] >= 78 && numbered[i] <= 90) {
numbered[i] -= 13;

}*/

//numbered[i] = String.fromCharCode(numbered[i]);
}

return numbered;

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Doug
@doug20000
Nov 30 2016 06:00
@revisualize thanks a million mate!
CamperBot
@camperbot
Nov 30 2016 06:00
doug20000 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2435 | @revisualize |http://www.freecodecamp.com/revisualize
Michael Pimentel Jr
@mtpjr88
Nov 30 2016 06:05
@Lumexralph i want a number
silver537
@silver537
Nov 30 2016 06:06
let user = revisualize;
while(user) console.log('YOU SUUUUUUCK!');
:D
@revisualize LEAVE you're breaking my code!
Nov 30 2016 06:10
@Saiduk you are soo close
Saiduk
@Saiduk
Nov 30 2016 06:10
Why don't those numbers change when the others do?
Nov 30 2016 06:11
@Saiduk so you have 2 if statements
change the other to an else if
Ogundele Olumide
@Lumexralph
Nov 30 2016 06:11
have you checked the type of value you're getting from the value you're getting from your answer element? because if you compare a string with a number using <= comparison operator you might get unusual behavior, that's why i suggested you're sure of what you're getting from answer. value before comparing it with number 96
@mtpjr88
Nov 30 2016 06:11
@Saiduk because you are essentially checking those numbers twice
@Saiduk once you've changed that you just perform a .join() on the string and you should be good to go
Saiduk
@Saiduk
Nov 30 2016 06:13
@adamakers yep, it worked. Thanks! :D Still, not sure why that makes a difference...
CamperBot
@camperbot
Nov 30 2016 06:13
saiduk sends brownie points to @adamakers :sparkles: :thumbsup: :sparkles:
Saiduk
@Saiduk
Nov 30 2016 06:14
I think I kinda get it, but I'm also getting a bit tired :P
Nov 30 2016 06:14
@Saiduk so with this input that we were given, 'SERR PBQR PNZC'
Saiduk
@Saiduk
Nov 30 2016 06:14
yeah
Nov 30 2016 06:15
@Saiduk if you look back at the return of the program the previous way you had it, none of the characters that were in the second if changed
Saiduk
@Saiduk
Nov 30 2016 06:16
yeah. I figured if the first if statement failed, it would read the second one
Nov 30 2016 06:16
@Saiduk i think I just confused myself
Saiduk
@Saiduk
Nov 30 2016 06:16
lol
Nov 30 2016 06:17
I see what you mean though. this is going to bug me
Saiduk
@Saiduk
Nov 30 2016 06:18
Welcome to my world
CamperBot
@camperbot
Nov 30 2016 06:18

## welcome to FreeCodeCamp @Saiduk!

Saiduk
@Saiduk
Nov 30 2016 06:18
ay lol
Nov 30 2016 06:18
hahaha
Nov 30 2016 06:32
still bugging me. Somehow, when you do it with the two if statements instead of if, else if, the first if fails. Even if str is ABC
tom43511
@tom43511
Nov 30 2016 06:34
Can someone take a look at my "Confirm the Ending" solution and tell me if there's a better way I could've done it?
Nov 30 2016 06:34
i'll take a peek. Not sure how much help I'll be
Tuka
Nov 30 2016 06:35
Hi there... i am a knew to free code camp and got stuck i gueass with some small thing. can someone look at that

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Fix Me
myStr = "Hello World";

tom43511
@tom43511
Nov 30 2016 06:35
function confirmEnding(str, target) {
var a = str.substring(str.length-target.length, str.length);
if (a == target){
return true;
}else {
return false;
}

return str;
}

confirmEnding("Bastian", "n");
@Tukadas what's the name of the challenge?
Nov 30 2016 06:36
@Saiduk I think I know why it was doing that.
@tom43511 im looking up the challenge right now
Tuka
Nov 30 2016 06:37
Understand String Immutability
tom43511
@tom43511
Nov 30 2016 06:39
Tyrone
@tsaulon
Nov 30 2016 06:39
I'm trying to convert decimal into a hexadecimal number; I can get the rest of the outputs except one. Anyone want to give it a crack?
var hexNum = 48879;
var hexDigits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'];
var results = [];
var counter = 1;
while(Math.floor(hexNum) > 0){
if(Math.floor(hexNum / 16) % 16 > 9){

results.unshift(hexDigits[(Math.floor(hexNum /= 16) % 16)]);
console.log('rot' + counter++ + ': ' + results);
}
else{
results.unshift(Math.floor(hexNum /= 16) % 16)
console.log('rot' + counter++ + ': ' + results);
}
}
Nov 30 2016 06:39
@tom43511 hey, so Im not sure you need that return str in the bottom of your code
tom43511
@tom43511
Nov 30 2016 06:40
@adamakers oops, didn't notice that was there
Nov 30 2016 06:40
@tom43511 as well as the else{return false}
Tuka
Nov 30 2016 06:40
ok got it haha
thanx
Nov 30 2016 06:41
@tom43511 you could just have taken that else out and put return false. JS functions are interesting. As soon as they hit a return statement it will capture that value and end the script
tom43511
@tom43511
Nov 30 2016 06:41
@adamakers I usually do else {return false} for the sake of cleanliness and the prevent potential problems
Nov 30 2016 06:42
ok, yea that makes sense
tom43511
@tom43511
Nov 30 2016 06:42
i know it's most likely not necessary but eh
Nov 30 2016 06:42
other than that yours looks kind of like mine
tom43511
@tom43511
Nov 30 2016 06:43
mind if I see yours?
Nov 30 2016 06:44
function confirmEnding(str, target) {
if (str.substr(target.length * -1) === target) {
return true;
}

return false;
}
confirmEnding("Bastian", "n");
tom43511
@tom43511
Nov 30 2016 06:46
almost the same except I made a variable which probably wasn't needed and got the start of my substr differently
Nov 30 2016 06:46
@Saiduk you still here?
@tom43511 right. Many ways to skin a cat. As long as it works then your good
youre
Jefferson
@jeffersonnnn
Nov 30 2016 06:47
Hi all, i am stuck at the Find the Longest Word in a String challenge. Can i have someone look at my code?


function findLongestWord(str) {
var findLongestWord = str.split(" ");
var longest = 0;
if (findLongestWord[0].length > longest) {
return findLongestWord.length;
}
for (var i = 0; i < findLongestWord.length; i++){
var the = findLongestWord[0];
return 6;
}
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Nov 30 2016 06:48
@jeffersonnnn hey man, one of your variables is the same name as your function. Try changing that first var to something else
tom43511
@tom43511
Nov 30 2016 06:48
@jeffersonnnn check str.length
You're checking the length of findLongestWord and not what's actually inside of it
changed my function to
function confirmEnding(str, target) {
if (str.substring(str.length-target.length, str.length) == target){
return true;
}else {
return false;
}

}

confirmEnding("Bastian", "n");
I need to remember that creating a variable isn't always needed
Jefferson
@jeffersonnnn
Nov 30 2016 06:53
@adamakers can i change the var findLongestWord = str.string(" "); ?
@tom43511 then how do i do this?
Nov 30 2016 06:55
@jeffersonnnn var strSplit = str.split(" ");
nandoBel
@nandoBel
Nov 30 2016 06:56
Hi
Nov 30 2016 06:56
@jeffersonnnn that will take your str and split it into an array. It will split it every time it sees a space
strSplit = ['the', 'quick', 'brown', ....]
nandoBel
@nandoBel
Nov 30 2016 06:57
Does anyone want to have a look and tell me why my submit-button don't work all of a sudden? Might have something to do firm the <form> tag itself, and the placing, but I can't understand it:
Nov 30 2016 06:58
@jeffersonnnn i would then get rid of the if statement

@jeffersonnnn
if (findLongestWord[0].length > longest) {
return findLongestWord.length;
}
because when you loop through it will check 0 again
@jeffersonnnn what do you have so far?
Fernando
@fer408
Nov 30 2016 07:02
I dont know what I am doing wrong can anyone help?

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

farenheit = celsius * 9/5 + 32;
// Only change code above this line
return fahrenheit;

}

// Change the inputs below to test your code
convertToF(30);

Nov 30 2016 07:03
@tom43511 I think the variables are nice. Makes the code easier to read. But for these shorter problems its not a big deal
@fer408 hey man, you spelled fahrenheit wrong
@fer408 line 4
David Michelet
@Peioa
Nov 30 2016 07:04
'''js
CamperBot
@camperbot
Nov 30 2016 07:04
:bulb: to format code use backticks!  more info
David Michelet
@Peioa
Nov 30 2016 07:04

 function caseInSwitch(val) {
// Only change code below this line
switch (val){
case 1:
console.log("alpha");
break;
case 2:
console.log("beta");
break;
case 3:
console.log("gamma");
break;
case 4:
console.log("delta");
break;

}

Can't see what's wrong
Fernando
@fer408
Nov 30 2016 07:05
CamperBot
@camperbot
Nov 30 2016 07:05
fer408 sends brownie points to @adamakers :sparkles: :thumbsup: :sparkles:
Nov 30 2016 07:05
@fer408 np
@Peioa which problem are you on?
David Michelet
@Peioa
Nov 30 2016 07:06
@adamakers "Selecting from many options with Switch Statements"
Don't see what's wrong in my statement
Nov 30 2016 07:07
instead, you need to assign the strings to a variable and then return that variable
if you open up your dev console you might see your answer in there. But a return statement is different from console.log
David Michelet
@Peioa
Nov 30 2016 07:08
I already have the val variable assign ? no ?
Nov 30 2016 07:08
@Peioa it does not look like it. right now you have
case 1:
console.log('alpha');
David Michelet
@Peioa
Nov 30 2016 07:09
I don't have anything on the console/ I get caseInSwitch(1) should have a value of "alpha"
Nov 30 2016 07:09
instead it should look something like this:
case 1:
break;
John
@johngunderson1
Nov 30 2016 07:10
since your return is answer, you need to assign a string to every answer for every variable
David Michelet
@Peioa
Nov 30 2016 07:11
I got you, thanks guys @johngunderson1 @adamakers
CamperBot
@camperbot
Nov 30 2016 07:11
peioa sends brownie points to @johngunderson1 and @adamakers :sparkles: :thumbsup: :sparkles:
Nov 30 2016 07:11
@Peioa np!
John
@johngunderson1
Nov 30 2016 07:11
my first brownie point!
David Michelet
@Peioa
Nov 30 2016 07:11
well deserved
Nov 30 2016 07:12
@nandoBel I cant open it on another window
Jefferson
@jeffersonnnn
Nov 30 2016 07:15
@adamakers oh yes, i understand now. What else can i do? Just saw the other suggestions. I shall implement right now.
Nov 30 2016 07:16
@jeffersonnnn can you send me your new code?
Jefferson
@jeffersonnnn
Nov 30 2016 07:20
@adamakers i need to get rid of the if statement? i used it to set a condition where the longestword var is updated when it is looking at a string that is longer than the last.
Nov 30 2016 07:22
@jeffersonnnn the if statement will go in our for loop or array method
so now that we have the string split into an array, we need to iterate over the array to check the length of each item in the array
to do that we have a couple of options. A for loop or we can use an array method, .map
each time we check one of those words, we are going to see IF that word is bigger than 0. If it is bigger than 0, then that words length becomes the new longest
Jefferson
@jeffersonnnn
Nov 30 2016 07:28

@adamakers give me a second to wipe these tears lol

So how do i use the .map method.

Brian Giles
@briangiles
Nov 30 2016 07:28
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line

var gloveBoxContents = myStorage.car[inside]."glove box";
Does anyone know where I’m head wrong on this one?
Instructions
Access the myStorage object and assign the contents of the glove box property to the gloveBoxContents variable. Use bracket notation for properties with a space in their name.
Nov 30 2016 07:29
@jeffersonnnn hey no worries man. I struggled at the beginning too. JS and programming is tough to wrap your head around. We'll get this
@briangiles you arent able to use dot notation on properties that have a space in them
Markus Kiili
@Masd925
Nov 30 2016 07:30
@briangiles Also inside needs quotes.
Brian Giles
@briangiles
Nov 30 2016 07:30
cumtlighter
@cumtlighter
Nov 30 2016 07:31
Markus Kiili
@Masd925
Nov 30 2016 07:31
JS engine thinks it is some variable if there are no quotes.
cumtlighter
@cumtlighter
Nov 30 2016 07:31
help
Brian Giles
@briangiles
Nov 30 2016 07:31
Nov 30 2016 07:33
@Masd925 I always forget about having to put in the quotes
@Masd925 good call
@jeffersonnnn how are you doing bud?
Jefferson
@jeffersonnnn
Nov 30 2016 07:36
@adamakers i am reading up on .map and trying to find a way to finesse it in here. Any tips?
Nov 30 2016 07:38
@jeffersonnnn thats a good option and what I did. Your parameter for the map function will be another function. Inside of that function will be your if statement
andry91959
@andry91959
Nov 30 2016 07:40
Hi, can someone explain why the result of this code is "6"
var str = "Visit W3Schools";
var n = str.search(/w3schools/i);
Nov 30 2016 07:41
@andry91959 that seems to be the index of where it found that string
andry91959
@andry91959
Nov 30 2016 07:41
oh so "visit" is count as 5?
shubhankarb180
@shubhankarb180
Nov 30 2016 07:42
Soution for Testing Objects for Properties Challenge
Nov 30 2016 07:42
@andry91959 right. as soon as that search finds that 'w' and the rest of the string matches, it will return the index of where it first starts
Markus Kiili
@Masd925
Nov 30 2016 07:42

@andry91959 Search return value: The index of the first match between the regular expression and the given string; if not found, -1.



Nov 30 2016 07:42
@andry91959 and you have the /i/ in there which I do believe means that casing doesnt matter
andry91959
@andry91959
Nov 30 2016 07:44
alright I think I understand thank you
shubhankarb180
@shubhankarb180
Nov 30 2016 07:45
Soution for Testing Objects for Properties Challenge
Nov 30 2016 07:45
@shubhankarb180 you can google them. There on github
theyre
shubhankarb180
@shubhankarb180
Nov 30 2016 07:45
ok
Nov 30 2016 07:46
just google the problem you are on and then "FreeCodeCamp" it will also give you additional tips
shubhankarb180
@shubhankarb180
Nov 30 2016 07:47
thanks
Jefferson
@jeffersonnnn
Nov 30 2016 07:47
@adamakers grateful. Thanks bro. I shall update you.
CamperBot
@camperbot
Nov 30 2016 07:47
jeffersonnnn sends brownie points to @adamakers :sparkles: :thumbsup: :sparkles:
Nov 30 2016 07:47
@jeffersonnnn I actually need to go to bed. Its very late here. How far along are you?
Jefferson
@jeffersonnnn
Nov 30 2016 07:48
@adamakers no so far, to be honest. Go to bed though, you need the rest. Thanks once again.
CamperBot
@camperbot
Nov 30 2016 07:48
jeffersonnnn sends brownie points to @adamakers :sparkles: :thumbsup: :sparkles:
Nov 30 2016 07:51

you're getting closer by looking into .map. should look something like

strArr.map(function(word){
//rest of the logic
})

then return wordLen

the word in parenthesis is the word that is being evaluated
@jeffersonnnn im sorry to bail on you. I will be on tomorrow though if you still need any help
Jefferson
@jeffersonnnn
Nov 30 2016 07:55
No problem yo, i will plough through it. @adamakers
shubhankarb180
@shubhankarb180
Nov 30 2016 07:56

// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
if (myObj.hasOwnProperty("checkProp")=== true);
{
return myObj[checkProp];
}

// Test your code by modifying these values
checkObj("house");

there is a probelem with the last return statement
Max
@ImFeelingDucky
Nov 30 2016 07:59
@shubhankarb180 try removing the quote marks from if (myObj.hasOwnProperty("checkProp")=== true); {
from the parameter checkProp
since you don't want to be checking if the object has a property with the name "checkProp": instead you want to check if it has a property with the name of the value of checkProp
Saiduk
@Saiduk
Nov 30 2016 08:00
shubhankarb180
@shubhankarb180
Nov 30 2016 08:00
@ImFeelingDucky no changes buddy
Max
@ImFeelingDucky
Nov 30 2016 08:02
@shubhankarb180 what is the name of the challenge?
shubhankarb180
@shubhankarb180
Nov 30 2016 08:03
@ImFeelingDucky testing objects for properties
Max
@ImFeelingDucky
Nov 30 2016 08:04
@shubhankarb180 The semicolon after the if statement was a problem
Semicolons aren't used after if ()s
Stanley Su
@cuddlycuddles
Nov 30 2016 08:05
tru
Max
@ImFeelingDucky
Nov 30 2016 08:05
also wrap the last return in an else block
shubhankarb180
@shubhankarb180
Nov 30 2016 08:05
@ImFeelingDucky thanks bro .. i got the solution
CamperBot
@camperbot
Nov 30 2016 08:05
shubhankarb180 sends brownie points to @imfeelingducky :sparkles: :thumbsup: :sparkles:
Max
@ImFeelingDucky
Nov 30 2016 08:06
@shubhankarb180 Sure :+1:
Stanley Su
@cuddlycuddles
Nov 30 2016 08:06
@ImFeelingDucky Could you also put it beneath the curly brace?
Max
@ImFeelingDucky
Nov 30 2016 08:07
@cuddlycuddles Put what beneath the curly brace? A semicolon?
Stanley Su
@cuddlycuddles
Nov 30 2016 08:07
if (myObj.hasOwnProperty(checkProp)=== true)
{
return myObj[checkProp];
}
return "Not Found"; }
Like that?
Max
@ImFeelingDucky
Nov 30 2016 08:07
@cuddlycuddles Yeah that's perfect
Stanley Su
@cuddlycuddles
Nov 30 2016 08:08
@ImFeelingDucky Thanks, was just confirming :P
CamperBot
@camperbot
Nov 30 2016 08:08
cuddlycuddles sends brownie points to @imfeelingducky :sparkles: :thumbsup: :sparkles:
Max
@ImFeelingDucky
Nov 30 2016 08:08
Because return does something, so needs a semicolon afterwards :)
Markus Kiili
@Masd925
Nov 30 2016 08:08
@cuddlycuddles That ===true is redundant.
Max
@ImFeelingDucky
Nov 30 2016 08:08
@Masd925 true :laughing:
Stanley Su
@cuddlycuddles
Nov 30 2016 08:08
@Masd925 Yeah sorry, just copied the other guys code lel
Nov 30 2016 08:09

As far as Javascript is concerned

if (myObj.hasOwnProperty(checkProp)=== true)

is completely equivalent to

if (myObj.hasOwnProperty(checkProp))
Max
@ImFeelingDucky
Nov 30 2016 08:10
@cuddlycuddles Still, some people don't use semicolons at all, because they'll be automatically inserted anyway if you don't put them in. But it's up to you
Nov 30 2016 08:11
This is why it is advisable to use tools like jslint so that one writes standard code.
Use of semicolons is hightly encouraged.
I'm yet to understand the rationale behind why some people insist on not using them.
Max
@ImFeelingDucky
Nov 30 2016 08:15
@Adi2Point0 I think the main argument against not using them is that the browser can sometimes get confused about semicolons in rare situations (e.g. when the line after a statement without a semicolon begins with [ of ( ) but otherwise they... save time?
@Adi2Point0 * not using them saves time
mohamedsaieed
@mohamedsaieed
Nov 30 2016 08:16
any help pls
Max
@ImFeelingDucky
Nov 30 2016 08:16
mohamedsaieed
@mohamedsaieed
Nov 30 2016 08:17
the <li> is reflected and not in the header
Max
@ImFeelingDucky
Nov 30 2016 08:17
for arguments for / against
Nov 30 2016 08:17
I see what you're saying. However what I am talking about placing semicolon where you, as a programmer, know the statement ends.
Browsers are unreliable in this department.
Krzysztof Borowy
@Krizzu
Nov 30 2016 08:24
@mohamedsaieed If You need help, tell us what's the case?
Nov 30 2016 08:24
http://codepen.io/mradil16/pen/xRXLXa Hi everyone. How can I create a slider loop from left to right in this example . thx for help
Nov 30 2016 08:30

I wrote this code for the "left button" :

  $("#left").click(function() {$slideContainer.animate({'margin-left': '-='+width}, animationSpeed, function() {
if (++currentSlide === $slides.length) { currentSlide = 1;$slideContainer.css('margin-left', 0);
}
});
});

But I don't know how to do the same thing for the "right button"

Nov 30 2016 08:39
what I should write inside the callback function to complete the cycle from left to right :
 $("#right").click(function() {$slideContainer.animate({'margin-left': '+='+width}, animationSpeed, function() {
//.............................
});
});
mohamedsaieed
@mohamedsaieed
Nov 30 2016 08:42
@Krizzu if you run my pen u will find that the <li>element is reflected and is under the header
Luc Neesby
@lucneesby
Nov 30 2016 08:53

var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;

case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;

}
if (count > 0){
return count + "Bet";
} else {
return count + "Hold";
}

return "Change Me";
// Only change code above this line
}

darkflikk
@darkflikk
Nov 30 2016 08:53
Luc Neesby
@lucneesby
Nov 30 2016 08:53
im doing the card challenge am I missing something? ffc comes back negative
Markus Kiili
@Masd925
Nov 30 2016 08:54
@lucneesby Put a space between count and Bet/Hold.
" Bet" etc
Luc Neesby
@lucneesby
Nov 30 2016 08:55
appreciate it
its late and I'm missing obvious details
sstormyr94
@sstormyr94
Nov 30 2016 09:08
so I cant get past this one in js, the 'word blanks' where I'm supposed to make a mad libs game. I can't figure out at all what I'm supposed to do.
my current code is:
var result = (" " + myNoun + " " + myAdjective + " " + myVerb + " " myAdverb); //but this is obviously very wrong
Codemzy
@codemzy
Nov 30 2016 09:09
@sstormyr94 you are missing a + here... " " myAdverb
sstormyr94
@sstormyr94
Nov 30 2016 09:09
was that everything, wow now I feel even dumber :package:
thanks!
darkflikk
@darkflikk
Nov 30 2016 09:09
@sstormyr94 but ...
Codemzy
@codemzy
Nov 30 2016 09:09
@sstormyr94 and it doesnt need to be in brackets
darkflikk
@darkflikk
Nov 30 2016 09:10
@sstormyr94 that was not what this challenge was about
sstormyr94
@sstormyr94
Nov 30 2016 09:10
yeah i couldnt really understand the instructions
chedli
@chedlii
Nov 30 2016 09:10
@sstormyr94 dont worry that happen to everybody
:smile:
darkflikk
@darkflikk
Nov 30 2016 09:10
@sstormyr94 should i tell you?
sstormyr94
@sstormyr94
Nov 30 2016 09:11
if you would i would appreciate it!
darkflikk
@darkflikk
Nov 30 2016 09:11
Codemzy
@codemzy
Nov 30 2016 09:11
@sstormyr94 a lot of people get stuck on that challenge , you figured out most of it :thumbsup:
sstormyr94
@sstormyr94
Nov 30 2016 09:11
yeah i do
nandoBel
@nandoBel
Nov 30 2016 09:12
Does anyone want to have a look and tell me why my submit-button don't work all of a sudden? Might have something to do with the <form> tag itself, and the placing, but I can't understand it:
chedli
@chedlii
Nov 30 2016 09:12
for me the one that was tricky is the lookup variable , some kind of that
darkflikk
@darkflikk
Nov 30 2016 09:12
@sstormyr94 so you are supposed to write a function that take those parts and return a complete sentence
chedli
@chedlii
Nov 30 2016 09:12
@nandoBel are using jQuery ?
oyu*
you*
sstormyr94
@sstormyr94
Nov 30 2016 09:13
@darkflikk so something like this? var result = ("The " + myNoun + "was " + myAdjective + " and " + myVerb + " " + myAdverb);
darkflikk
@darkflikk
Nov 30 2016 09:13
@sstormyr94 yes
nandoBel
@nandoBel
Nov 30 2016 09:14
@chedlii No
darkflikk
@darkflikk
Nov 30 2016 09:14
@sstormyr94 more like that
nandoBel
@nandoBel
Nov 30 2016 09:14
@chedlii Validation via JavaScript only
sstormyr94
@sstormyr94
Nov 30 2016 09:14
@darkflikk yeah now theres a complete sentence, thanks for the help
CamperBot
@camperbot
Nov 30 2016 09:14
sstormyr94 sends brownie points to @darkflikk :sparkles: :thumbsup: :sparkles:
chedli
@chedlii
Nov 30 2016 09:14
Codemzy
@codemzy
Nov 30 2016 09:14
@sstormyr94 yeah but get rid the brackets.. you don't wrap a string in brackets...
chedli
@chedlii
Nov 30 2016 09:15
you should see a # in the url if it works
darkflikk
@darkflikk
Nov 30 2016 09:15
@nandoBel what is broken and how is it supposed to work=
Codemzy
@codemzy
Nov 30 2016 09:15
@sstormyr94 var result = "The " + myNoun + "was " + myAdjective + " and " + myVerb + " " + myAdverb;
sstormyr94
@sstormyr94
Nov 30 2016 09:15
@codemzy youre absolutely right, dont know why i had them in there
nandoBel
@nandoBel
Nov 30 2016 09:18
@chedlii The action can be empty, can't it? All I want to do is an error message to appear whenever user don't put in the requiered data
darkflikk
@darkflikk
Nov 30 2016 09:18
@nandoBel just seeing all the <br> tags tells me you should learn more about HTML/CSS before starting with JS :)
nandoBel
@nandoBel
Nov 30 2016 09:19
Yup, I'm a newbie. But telling me that doesn't really help, does it? Except for your ego ;)
<-salty
darkflikk
@darkflikk
Nov 30 2016 09:20
@nandoBel you are missing fundamental HTML knowledge. I recommend to work on learning more HTML first. Mozilla has good guides.
nandoBel
@nandoBel
Nov 30 2016 09:21
Still doesn't help me.
But... thanks?
darkflikk
@darkflikk
Nov 30 2016 09:21
@nandoBel There is just too much wrong for me to invest time in it. starting with the buttons not being part of a form.
then the returns in the onsubmit attributes
nandoBel
@nandoBel
Nov 30 2016 09:22
They are, I guess I hadn't updated the pen
darkflikk
@darkflikk
Nov 30 2016 09:22
a missing closing curly bracket in the JS code
nandoBel
@nandoBel
Nov 30 2016 09:23
That's also fixed
chedli
@chedlii
Nov 30 2016 09:25
@nandoBel nad why initializing invalid two times
and*
darkflikk
@darkflikk
Nov 30 2016 09:25
and you're not even paying attention to what codepen is telling you
"You don't need a DOCTYPE on CodePen. Just put here what you would normally put in the <body>."
vivek poddar
@vivekimsit
Nov 30 2016 09:25
course summary on javascript objects
hope that helps
darkflikk
@darkflikk
Nov 30 2016 09:26
the closing curly brackete is still missing
and the buttons are still not part of any form
nandoBel
@nandoBel
Nov 30 2016 09:29
Listen, @darkflikk, I started with all of this 2 months ago. I work fulltime as well, and I'm doing this just for fun. Now, I really appreciate you investing time into my work, and that you are giving me tips. So, let me give you one: try not to sound so condescending when you answer. It's just better to be polite.
@chedlii Thanks
CamperBot
@camperbot
Nov 30 2016 09:30
nandobel sends brownie points to @chedlii :sparkles: :thumbsup: :sparkles:
darkflikk
@darkflikk
Nov 30 2016 09:33
@nandoBel sorry, just wanted to be direct. I really recommend you doing the basics before you move on
nandoBel
@nandoBel
Nov 30 2016 09:33
I sure will :)
I have to hand this assigment in soo. We are working on basics forms and validation. I guess I went in waay over my head, but I really enjoy working with all of this. And you're right, I haven't got the experience to notice mistakes when doing things that are too complicated to my knowledge :)
nandoBel
@nandoBel
Nov 30 2016 09:39
I wanna ask you something very dumb, @darkflikk. How would you replace all my <br> 's?
darkflikk
@darkflikk
Nov 30 2016 09:40
@nandoBel css?
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:41
oh yeah, morning all :)
darkflikk
@darkflikk
Nov 30 2016 09:41
nandoBel
@nandoBel
Nov 30 2016 09:41
Ok
Thanks
darkflikk
@darkflikk
Nov 30 2016 09:42
@nandoBel yeah, many options
nandoBel
@nandoBel
Nov 30 2016 09:42
@darkflikk Thanks
CamperBot
@camperbot
Nov 30 2016 09:42
nandobel sends brownie points to @darkflikk :sparkles: :thumbsup: :sparkles:
darkflikk
@darkflikk
Nov 30 2016 09:44
@nandoBel you definately should read the complete guides at https://developer.mozilla.org/en-US/docs/Learn
Tshepo Mogano
@Mafahle
Nov 30 2016 09:44
Has anyone done word blanks in JavaScript yet?
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:44
Hello guys
i cannot find my solutions of the finished ones
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:45
@Mafahle What's the problem? :)
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:45
how to fix that?
darkflikk
@darkflikk
Nov 30 2016 09:45
@nandoBel even thought you're not starting at 0 you should start in the "complete beginner" section. I have a feeling there is still quite some things in there you don't know about
@kskthedeveloper what challenge?
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:46
every challenge
darkflikk
@darkflikk
Nov 30 2016 09:46
they are all there
nandoBel
@nandoBel
Nov 30 2016 09:46
@darkflikk A lot! :)
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:47
thanks @darkflikk
CamperBot
@camperbot
Nov 30 2016 09:47
kskthedeveloper sends brownie points to @darkflikk :sparkles: :thumbsup: :sparkles:
darkflikk
@darkflikk
Nov 30 2016 09:48
@kskthedeveloper interesting
Aleksander Gębicki
@Takumar
Nov 30 2016 09:48
@dlwheat34 generally other links are meant for questions:
https://gitter.im/FreeCodeCamp/HelpJavaScript
https://gitter.im/FreeCodeCamp/Help
but you can ask also here
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:48
i got stuck in Steamroller
darkflikk
@darkflikk
Nov 30 2016 09:48
@kskthedeveloper i am looking into your solutions :D
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:48
:D
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:49
Gauss?
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:49
@Takumar Heyy :)
darkflikk
@darkflikk
Nov 30 2016 09:49
Or let me ask you a question @kskthedeveloper
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:49
what is that?
ok
which one
Aleksander Gębicki
@Takumar
Nov 30 2016 09:49
Hi @Krizzu
darkflikk
@darkflikk
Nov 30 2016 09:49
@kskthedeveloper what is the the sum of all numbers from 1 - 100?
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:50
@Takumar Long time no see :)
Aleksander Gębicki
@Takumar
Nov 30 2016 09:50
@Krizzu true, I'm not frequent guest here :-)
(if it sounds English enough)
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:50
I try to stay away from FCC main room :P
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:51
sry
Krzysztof Borowy
@Krizzu
Nov 30 2016 09:51
Feel safer here :smile:
darkflikk
@darkflikk
Nov 30 2016 09:51
@kskthedeveloper if you think about it, you can come it with a formula on how to solve that. i could give a hint if you want
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:51
i have a solution for it
darkflikk
@darkflikk
Nov 30 2016 09:51
yes?
Blauelf
@Blauelf
Nov 30 2016 09:52
@darkflikk Gauss was not the first one to discover the sum formula. But the one that we remember today.
darkflikk
@darkflikk
Nov 30 2016 09:52
that is correct
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:52
@darkflikk why do u ask me that?
Blauelf
@Blauelf
Nov 30 2016 09:52
Gauss formula is O(1), summing numbers is O(n). Much more efficient :D
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:53
i got stuck with Steamroller
darkflikk
@darkflikk
Nov 30 2016 09:53
@kskthedeveloper because you could come up with a better solution with that hint :D
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:53
ok
what is that hint
darkflikk
@darkflikk
Nov 30 2016 09:54
but if you want to stay with steamroller let me check that
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:54
hint first
CamperBot
@camperbot
Nov 30 2016 09:54
Set a bonfire to talk about with bonfire name
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:54
i got a solution for Steamroller but i am still wrong
Blauelf
@Blauelf
Nov 30 2016 09:54
@kskthedeveloper Do you have somewhat working code? Do you go with recursion, or without?
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:55
recursion
mr.c
@chouqing15
Nov 30 2016 09:55
I heard in the United States, everyone can computer programming?
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:55
how to send code in here
darkflikk
@darkflikk
Nov 30 2016 09:55
'''
CamperBot
@camperbot
Nov 30 2016 09:55
:bulb: to format code use backticks!  more info
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:56
var myArr = [];
function steamrollArray(arr) {
// I'm a steamroller, baby
for( var i = 0; i < arr.length; i++){
if(Array.isArray(arr[i]))
returnValue(arr[i]);
else
myArr.push(arr[i]);
}
return myArr;
}

function returnValue(arr) {
for( var i = 0; i < arr.length; i++) {
if(!Array.isArray(arr[i]))
myArr.push(arr[i]);
else
returnValue(arr[i]);
}
}
Ghulam Shabir
@ghulamshabir
Nov 30 2016 09:57
@kskthedeveloper myArr is global, move it down to make it local
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 09:58
ok
because of global?
Thanks
passed
@ghulamshabir why ?
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:00
@kskthedeveloper because fcc calls your function multiple times to check the correct solution so global variables confuse fcc interpreter
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:01
@Blauelf i am kind of reserved when it comes to recursion
@ghulamshabir hey bro
Blauelf
@Blauelf
Nov 30 2016 10:01
@kskthedeveloper The global variable is not reset between multiple calls to steamrollArray.
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:01
@Lumexralph hey dear
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:01
@ghulamshabir back and better surely?
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 10:01
@Blauelf Thanks, i got it;
CamperBot
@camperbot
Nov 30 2016 10:01
kskthedeveloper sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 3078 | @blauelf |http://www.freecodecamp.com/blauelf
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 10:01
what is brownie points?
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:02
explain brownie
CamperBot
@camperbot
Nov 30 2016 10:02
no wiki entry for: brownie
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:02
:o shocker!
Blauelf
@Blauelf
Nov 30 2016 10:02
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 10:02
what is that for?
@Blauelf
Blauelf
@Blauelf
Nov 30 2016 10:02
@Krizzu @camperbot lost its connection to the wiki some time ago.
darkflikk
@darkflikk
Nov 30 2016 10:03
@Blauelf why didn't you fix it by now?
Blauelf
@Blauelf
Nov 30 2016 10:03
@kskthedeveloper Brownie points are for fun. They are some indicator of activity, and gaining at least one of them daily creates a "streak".
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 10:04
ok
Blauelf
@Blauelf
Nov 30 2016 10:04
@darkflikk Not my bot. I assume it was disconnected intentionally, as at that time the forum was promoted more aggressively.
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:04
Blauelf
@Blauelf
Nov 30 2016 10:05
And the forum contains copies of the wiki articles -> http://forum.freecodecamp.com/t/free-code-camp-brownie-points/18380
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:06
@Lumexralph yes thanks to God, and thanks you too
CamperBot
@camperbot
Nov 30 2016 10:06
ghulamshabir sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:07
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:08
Kaung San Kyaw
@kskthedeveloper
Nov 30 2016 10:08
@Blauelf
how can i get a job after here?
:D
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:09
@ghulamshabir it's going well, thanks.....want to start react
CamperBot
@camperbot
Nov 30 2016 10:09
lumexralph sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1176 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:09
learning
@ghulamshabir in school, right?
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:10
@Lumexralph great, react is fun to learn, its simplifies js front end programming
no I am back now its 3:10 pm here
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:11
@ghulamshabir am eager
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:11
any help pls
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:11
@ghulamshabir am anxious to know the difference from jquery
Mais
@mais-hatem
Nov 30 2016 10:11

 // Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
if (myObj.hasOwnProperty(checkProp) === true)
return myObj.checkProp;
}

// Test your code by modifying these values
checkObj("gift"); 

mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:12
my <li> element is reflected
darkflikk
@darkflikk
Nov 30 2016 10:12
@kskthedeveloper My experience tells me that code camps and self taught developers have a kind of bad reputation. Not as bad as indian outsource but still.
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:12
@mais-hatem you're using a variable so dot notation won't work
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:12
@Lumexralph its totaly different programing concept
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:13
@mais-hatem myObj.checkProp; you use bracket when dealing with variables
Aleksander Gębicki
@Takumar
Nov 30 2016 10:13

@mais-hatem if you check if value is true you can simplify this line:
if (myObj.hasOwnProperty(checkProp) === true) to:

if (myObj.hasOwnProperty(checkProp))

the result is the same

@mais-hatem which challenge is it?
Mayur
@mayurpande
Nov 30 2016 10:13
Is it bad practice to put a while loop inside of an if statement? i.e. is this bad practice?
function range(start,end,index){
var arr = [];

if(start<end){
while(start<=end){
if(index === undefined){
arr.push(start);
start++;
}else if(index > 0){
arr.push(start);
start+=index;
}
}
}else{
while(start>=end){
if(index === undefined){
arr.push(start);
start--;
}else if(index < 0){
arr.push(start);
start += index;
}
}
}
return arr;

}

console.log(range(1, 10));
// → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
console.log(range(5, 2, -1));
// → [5, 4, 3, 2]
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:13
@ghulamshabir interesting, mind expatiating ?
darkflikk
@darkflikk
Nov 30 2016 10:13
@mohamedsaieed what do you mean with reflected? and this is JS help, not HTML CSS :)
Mais
@mais-hatem
Nov 30 2016 10:13
@Lumexralph Thanks very much
@Takumar
CamperBot
@camperbot
Nov 30 2016 10:13
mais-hatem sends brownie points to @lumexralph and @takumar :sparkles: :thumbsup: :sparkles:
:star2: 3402 | @takumar |http://www.freecodecamp.com/takumar
Mais
@mais-hatem
Nov 30 2016 10:13
it worked
Testing Objects for Properties
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:14
@mohamedsaieed You can add ul { position: absolute; right: 1px} to make it inside your nav.
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:15
@darkflikk if you see its not in the header and it starts with(contact) not (home)
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:15
@Lumexralph when you use html tags in react, it will create js object representation of html tags
@Lumexralph you will be manipulating those objects outside of DOM
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:16
@Krizzu no effect
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:17
@ghulamshabir wow, interesting more like a copy of the tags in object form? means you can add properties and change for the tags, if am not mistaken?
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:17
@mohamedsaieed oh, add in ul : top: 1px
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:18
@ghulamshabir what resources can you recommend ?
i should start over the weekend
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:18
@Lumexralph there are many, free online videos and tutorials
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:19
@Lumexralph You know jquery?
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:19
@Krizzu yeah
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:19
@Lumexralph just google you will get plenty of resources
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:20
@Krizzu cool, thanks @ghulamshabir
CamperBot
@camperbot
Nov 30 2016 10:20
lumexralph sends brownie points to @krizzu and @ghulamshabir :sparkles: :thumbsup: :sparkles:
:warning: lumexralph already gave ghulamshabir points
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:20
@Krizzu ul { position: absolute;
right: 1px;
top: 1px;} ??
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:20
@mohamedsaieed yup
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:20
@Krizzu it didnt work
Ogundele Olumide
@Lumexralph
Nov 30 2016 10:20
@Krizzu funny enough i had opened that site months ago
it's a coincidence am back there
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:21
@mohamedsaieed you have to put that ul outside of nav
@Lumexralph :)
darkflikk
@darkflikk
Nov 30 2016 10:23
@mohamedsaieed sry, was distracted
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:24
@Krizzu thank you so much :)
CamperBot
@camperbot
Nov 30 2016 10:24
mohamedsaieed sends brownie points to @krizzu :sparkles: :thumbsup: :sparkles:
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:24
@mohamedsaieed No worries
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:27

darkflikk
@darkflikk
Nov 30 2016 10:27
@mohamedsaieed still not good
albezln
@albezln
Nov 30 2016 10:28
Hello does anyone know how to fix this? FreeCodeCamp/FreeCodeCamp#5559 i've just
darkflikk
@darkflikk
Nov 30 2016 10:28
@mohamedsaieed revert the changes and just make <nav> float: right
@albezln what's wrong?
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:29
@mohamedsaieed remove float: right from it
albezln
@albezln
Nov 30 2016 10:29

@darkflikk this is my code:
function myLocalScope() {
var myVar = 'use strict';
console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test
but i still have this message: No global myVar variable

mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:30
thx again @darkflikk and @Krizzu
CamperBot
@camperbot
Nov 30 2016 10:30
mohamedsaieed sends brownie points to @darkflikk and @krizzu :sparkles: :thumbsup: :sparkles:
:warning: mohamedsaieed already gave krizzu points
Stephen James
@sjames1958gm
Nov 30 2016 10:30
@albezln you did comment out the last console.log?
mohamedsaieed
@mohamedsaieed
Nov 30 2016 10:30
Stephen James
@sjames1958gm
Nov 30 2016 10:31
@albezln Or just delete it?
albezln
@albezln
Nov 30 2016 10:31
@sjames1958gm yes : //console.log(myVar); but always : "No global myVar variable"
darkflikk
@darkflikk
Nov 30 2016 10:32
@albezln cann you link the challenge in the state you'd call finished?
albezln
@albezln
Nov 30 2016 10:33
@darkflikk sorry don't understand what you're saying...
darkflikk
@darkflikk
Nov 30 2016 10:33
just post the complete link of the challenge
@albezln
albezln
@albezln
Nov 30 2016 10:34
darkflikk
@darkflikk
Nov 30 2016 10:34
Stephen James
@sjames1958gm
Nov 30 2016 10:34
darkflikk
@darkflikk
Nov 30 2016 10:35
ok, it passes for me
Stephen James
@sjames1958gm
Nov 30 2016 10:36
darkflikk
@darkflikk
Nov 30 2016 10:36
@albezln and you don't pass the "No global myVar variable" test?
albezln
@albezln
Nov 30 2016 10:36
@darkflikk exactly. i still have "No global myVar variable"
@albezln sorry, now it run! but why?
darkflikk
@darkflikk
Nov 30 2016 10:37
@albezln magic
albezln
@albezln
Nov 30 2016 10:38
@darkflikk thanks ... (anyway this is what i did five minutes ago.... but it didn' run..)
CamperBot
@camperbot
Nov 30 2016 10:38
albezln sends brownie points to @darkflikk :sparkles: :thumbsup: :sparkles:
RakeshNerkar
@Rakesh18754
Nov 30 2016 10:39
@DanCouper Thanks a lot
CamperBot
@camperbot
Nov 30 2016 10:39
rakesh18754 sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
Stephen James
@sjames1958gm
Nov 30 2016 10:40
@albezln :+1:
@albezln The issue is probably that myVar gets defined in the global space and is stuck there
Mayur
@mayurpande
Nov 30 2016 10:42
it this considered bad practice? i.e. putting a while loop within an if statement?
// Your code here.
function range(start,end,index){
var arr = [];

if(start<end){
while(start<=end){
if(index === undefined){
arr.push(start);
start++;
}else if(index > 0){
arr.push(start);
start+=index;
}
}
}else{
while(start>=end){
if(index === undefined){
arr.push(start);
start--;
}else if(index < 0){
arr.push(start);
start += index;
}
}
}
return arr;

}

function sum(arr){
var sum = 0;
for(var i = 0; i<arr.length;i++){
sum+=arr[i];
}
return sum;

}

console.log(range(1, 10));
// → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
console.log(range(5, 2, -1));
// → [5, 4, 3, 2]
console.log(sum(range(1, 10)));
Kartikeya Gupta
@kartikeya100
Nov 30 2016 10:43
this is my weather app with react and react router.....i am able to get latitute and longitute of location but unable to load city and location
https://codepen.io/kartikeya100/full/oYvjRB
line 111 Geolocal
everything is working fine but unable to get componentdidmount again
Krzysztof Borowy
@Krizzu
Nov 30 2016 10:46
@kartikeya100 check console for errors
Stephen James
@sjames1958gm
Nov 30 2016 10:48
@mayurpande Putting a while loop inside an if is fine
Kartikeya Gupta
@kartikeya100
Nov 30 2016 10:49
@Krizzu i am unable to do compenent did mount again when i get lat and long values
"Warning: You are manually calling a React.PropTypes validation function for thegetComponentsprop onIndexRoute. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.
console
Stephen James
@sjames1958gm
Nov 30 2016 10:49
@mayurpande Although in this case I would probably assign to variables and put the while loop after with the new variables
create high and low depending on which is greater start or end then while (low <= high)
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:52
@kartikeya100 I think you can not call componentDidMount on your own
Kartikeya Gupta
@kartikeya100
Nov 30 2016 10:53
@ghulamshabir it can be called by triggering a button ( as done on search location page)but i am doing it using timer but its not working
Ghulam Shabir
@ghulamshabir
Nov 30 2016 10:56
@kartikeya100 you can initialize state variabes/objects with empty strings or nulls then check for those variables in render method of main class, if their values are default ones , then set the react componenet to null
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:00
@kartikeya100 well, I got Uncaught (in promise) TypeError: Cannot read property 'temp_c' of undefined
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:02
@Krizzu could u give me your updated code.....or it this the error you are getting with my code
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:03
@kartikeya100 I got it with your code
click on Search location
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:04
its good just type in location and it will work.....i want help on my location page
i am getting lat and long and writing it on page
but how to i use this lat and long and get location(city, country) of the user
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:06
Well, my guess is that error is blocking it
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:07
@Krizzu get they are on different pages.....react router
and in my code i am unable to mount weather API with long and lat
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:08
But anyway, You would want to get long and lat when Parent component (or Container component, as I prefer this way) mounts, then pass it to sub-comps by props
Mayur
@mayurpande
Nov 30 2016 11:10

@sjames1958gm thanks, bit confused about what your saying about assigning to variables. Do you mean, simply store the variables like this before the while loop;

var low = start;
var high = end;
//or if I don't know the which is higher or lower I could do something like this
var low = Math.max(start,end);
var high = Math.min(start,end);

Is this what you are suggesting?

CamperBot
@camperbot
Nov 30 2016 11:10
mayurpande sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4612 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 30 2016 11:11
@mayurpande Exactly - it appears the two while loops only differ on which is higher / lower
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:12
@Krizzu every component rather and GeoLocal(line 111) is working fine.........you get long and lat request when page loads....but i want to use this lat and long to get location so i could get weather
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:14
@kartikeya100 Okay... So you get long and lat in GeoLocal... do you pass it somewhere?
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:16
yes......i tried but its not working
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:18
@kartikeya100 Did You tried simplest debugging stuff by putting console.log in handler function to see if it's getting called?
Kartikeya Gupta
@kartikeya100
Nov 30 2016 11:20
@Krizzu yes i tried some tools but none worked
CamperBot
@camperbot
Nov 30 2016 11:20
kartikeya100 sends brownie points to @krizzu :sparkles: :thumbsup: :sparkles:
Krzysztof Borowy
@Krizzu
Nov 30 2016 11:21
@kartikeya100 Well I did, and handler is not fired. I added one more function, error and added it as a second parameter to navigator.geolocation.getCurrentPosition. Turns out, you get an error: "Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)."
Stephen James
@sjames1958gm
Nov 30 2016 11:21
@kartikeya100 Maybe you should pass the lat long back to the container component and then let the container component pass them to the weather component
@kartikeya100 Then you could update the weather on componentDidReceiveProps
tsyapa
@tsyapa
Nov 30 2016 11:32
can't figure out what's wrong with #206

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup={
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"};
}
result=lookup[val];

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("");

return Illegal return statement
Ghulam Shabir
@ghulamshabir
Nov 30 2016 11:36
@tsyapa you have an extra brace, remove one of braces from these "foxtrot":"Frank"}; }
Stephen James
@sjames1958gm
Nov 30 2016 11:36
@tsyapa extra } after "Frank" remove the }; or the next line
@tsyapa When you see Illegal return statement usually means your function has been closed prematurely
Count your } to make sure you have balance
ajay1008
@ajay1008
Nov 30 2016 11:40

Hy guys, Need help on this. I have a series of vimeo video's in a single web page, I am using wordpress codeflavour plugin for vimeo video posts.

Vimeo video's have this feature like, when I play a video#1, and next if I play another video#2 in that same page below, the previous video#1 gets paused, and video#2 starts playing and vice versa.

This same feature is not working in my scenario in the plugin. The plugin is loading all the videos in its iframe. I am not able to access the click event on these iframe's.

I searched a lot, and found that, I am trying to use from different protocol, that is; I am trying from (http) to access contents of (https).

Please suggest hack for getting the click for play / pause to detect.

Regards,
Ajay.

Hy guys, Need help on this. I have a series of vimeo video's in a single web page, I am using wordpress codeflavour plugin for vimeo video posts.

Vimeo video's have this feature like, when I play a video#1, and next if I play another video#2 in that same page below, the previous video#1 gets paused, and video#2 starts playing and vice versa.

This same feature is not working in my scenario in the plugin. The plugin is loading all the videos in its iframe. I am not able to access the click event on these iframe's.

I searched a lot, and found that, I am trying to use from different protocol, that is; I am trying from (http) to access contents of (https).

Please suggest hack for getting the click for play / pause to detect.

Regards,
Ajay.

l2ose
@l2ose
Nov 30 2016 11:45
Hey guys! I have question on 'Escape Sequences in Strings Level'. what is the difference between: \n newline and \r carriage return?
Nov 30 2016 11:50
@l2ose New line (\n) take you to the next line i.e it works as an enter key basically
While carriage return (\r) just places the cursor on the start of the line
Riveniers
@Riveniers
Nov 30 2016 11:51

function myLocalScope() {
'use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test

can anyone help me?

Instructions
Declare a local variable myVar inside myLocalScope. Run the tests and then follow the instructions commented out in the editor.
Nov 30 2016 11:52
@Riveniers will you provide me the name of the challenge
Riveniers
@Riveniers
Nov 30 2016 11:52
Nov 30 2016 11:56
@Riveniers here is the solution
function myLocalScope() {
var myVar='use strict';
console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
//console.log(myVar);

// Now remove the console log line to pass the test
WAINGOR
@WAINGOR
Nov 30 2016 11:57
Hi my fellow code campers! I am currently stuck @ goo.gl/J3146G

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
switch(val) {
case "alpha":
break;
case "bravo":
result = "Boston";
break;
case "charlie":
result = "Chicago";
break;
case "delta":
result = "Denver";
break;
case "echo":
result = "Easy";
break;
case "foxtrot":
result = "Frank";
}

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");
EthanDCX
@EthanDCX
Nov 30 2016 11:57

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("asfasdfasdf", "big", "ran", "quickly");

Riveniers
@Riveniers
Nov 30 2016 11:57
@adityac0620 it show's " no global myVar variable " on the left.
Stephen James
@sjames1958gm
Nov 30 2016 11:57
@WAINGOR You need to convert the switch to an object - the instructions give the basic idea,
But each case value and result become a property / value on the object
EthanDCX
@EthanDCX
Nov 30 2016 11:57
how to solve the question？
Stephen James
@sjames1958gm
Nov 30 2016 11:58
@Riveniers If removing the console.log at the bottom does not work - then refresh the page
l2ose
@l2ose
Nov 30 2016 11:58
CamperBot
@camperbot
Nov 30 2016 11:58
l2ose sends brownie points to @adityac0620 :sparkles: :thumbsup: :sparkles:
Nov 30 2016 11:59
@l2ose welcome
Stephen James
@sjames1958gm
Nov 30 2016 11:59
@EthanDCX These 4 parameters will contain strings (word) when the function runs, myNoun, myAdjective, myVerb, myAdverb
use string concatenation to build a sentence into the result variable - you need to put string literals between them so there are
at least spaces between the passed in words
Riveniers
@Riveniers
Nov 30 2016 11:59
@sjames1958gm thank you. not sure why it's like that. confused the hell out of me lol
CamperBot
@camperbot
Nov 30 2016 11:59
riveniers sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4613 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
WAINGOR
@WAINGOR
Nov 30 2016 12:00
@sjames1958gm you are right I'm sorry here is my updated code. I know how to pass this question, I just dont know why its working when I place
var result = lookup.val;
in bracket notation... It wont work as lookup.val, why is this? Here is my entire code (never mind the last code I sent:

// Setup
function phoneticLookup(val) {

// Only change code below this line
var lookup = {
bravo: "Boston",
charlie: "Chicago",
delta: "Denver",
echo :"Easy",
foxtrot: "Frank"
};
var result = lookup.val;
// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");
Stephen James
@sjames1958gm
Nov 30 2016 12:00
@Riveniers myVar can get defined in the global space and until you refresh it isn't cleared even though your code looks like it is
Riveniers
@Riveniers
Nov 30 2016 12:00
@sjames1958gm yeah i got it thank u. your profile looks insane lol. how many hours u code a day ?
CamperBot
@camperbot
Nov 30 2016 12:00
riveniers sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: riveniers already gave sjames1958gm points
Stephen James
@sjames1958gm
Nov 30 2016 12:01
@WAINGOR .val will look for "val" property - [val] will evaluate the variable val to the property name
@Riveniers No more then 15 :)
WAINGOR
@WAINGOR
Nov 30 2016 12:01
really? aaah so the bracket notation creates a kind of "safe environment" so to speak
for entering properties through variable names...
I never knew
thanks @sjames1958gm , I have seen you here more often, you are a great contributor/carrier of these awesome communities
CamperBot
@camperbot
Nov 30 2016 12:02
waingor sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4614 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 30 2016 12:03
@WAINGOR thanks - I try :)
CamperBot
@camperbot
Nov 30 2016 12:03
sjames1958gm sends brownie points to @waingor :sparkles: :thumbsup: :sparkles:
EthanDCX
@EthanDCX
Nov 30 2016 12:07
@sjames1958gm Oh，my God.I feel crash. Do you have finish code?
@sjames1958gm Think you ! Think you ! Think you !
darkflikk
@darkflikk
Nov 30 2016 12:08
@EthanDCX just giving out solutions is never a good idea
EthanDCX
@EthanDCX
Nov 30 2016 12:14
@darkflikk oh，thinks
Stephen James
@sjames1958gm
Nov 30 2016 12:18
@EthanDCX The idea is result = "This " + myNoun plus other values
Its thanks not thinks
CamperBot
@camperbot
Nov 30 2016 12:18
sjames1958gm sends brownie points to @ethandcx :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ethandcx
Krzysztof Borowy
@Krizzu
Nov 30 2016 12:25
and even an english teacher! Is there something You can't do, @sjames1958gm ? :D
EthanDCX
@EthanDCX
Nov 30 2016 12:26
Thanks everybody! Truely
Stephen James
@sjames1958gm
Nov 30 2016 12:28
@Krizzu lol
Krzysztof Borowy
@Krizzu
Nov 30 2016 12:28
:P
Stephen James
@sjames1958gm
Nov 30 2016 12:28
@EthanDCX :+1:
Nov 30 2016 12:37
Hi, stuck on "Using objects for Lookups"

var lookup = {
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"
};

lookup[result];

what am i doing wrong please Javascripters?
Stephen James
@sjames1958gm
Nov 30 2016 12:38
@haddly result is returned - but you are not setting it to your lookup