These are chat archives for FreeCodeCamp/HelpJavaScript

27th
Aug 2016
David Halls
@DavidHalls
Aug 27 2016 00:00 UTC
@crazymaster49 11 % 3 = 1 does not do anything
crazymaster49
@crazymaster49
Aug 27 2016 00:00 UTC
javascript
Moisés Man
@moigithub
Aug 27 2016 00:00 UTC
@crazymaster49 u need to create a math expression and assign it to a variable...
javascript will calculate whatever result is
ie: total = 2+5;
crazymaster49
@crazymaster49
Aug 27 2016 00:01 UTC
ok thank you all, but how do you use finding a remainder in JavaScript? if that is not correct.
Moisés Man
@moigithub
Aug 27 2016 00:02 UTC
using the remainder operator %
+ adition operator total = 2 + 5
/ division operator total = 2 / 5
* multiplication operator... total = 2 * 5
soo.. how u would find remanding using the remainder operator ??? %
Egoscio
@Egoscio
Aug 27 2016 00:02 UTC
a.k.a. modulo
crazymaster49
@crazymaster49
Aug 27 2016 00:03 UTC
Can you give me an example @moigithub in code of how this is used?
Joseph Parkton
@hippybear
Aug 27 2016 00:03 UTC
@Egoscio I think there is a difference
3 % 9 === 0
Vishon
@Symbolistic
Aug 27 2016 00:03 UTC
is it bad that i'm using google to figure out some codes/functions so i can use them in the algorithm challenges? or is that normal to do...?
Joseph Parkton
@hippybear
Aug 27 2016 00:04 UTC
3 % 5 == 2
@Symbolistic not at all
Moisés Man
@moigithub
Aug 27 2016 00:04 UTC
re-read above.. the examples using differents operators.. @crazymaster49
Joseph Parkton
@hippybear
Aug 27 2016 00:04 UTC
@Symbolistic knowing how to google is the sign of a good programmer lol
crazymaster49
@crazymaster49
Aug 27 2016 00:04 UTC
Thank you all!
Vishon
@Symbolistic
Aug 27 2016 00:04 UTC
@hippybear cool, I was wondering cause it felt really easy after googling my problems, lol.
Joseph Parkton
@hippybear
Aug 27 2016 00:05 UTC
@crazymaster49 you can also do this in your devtools and see it in action
Moisés Man
@moigithub
Aug 27 2016 00:05 UTC
of course u need to use whatever variable name /values the instruction tells u to do.. @crazymaster49
Joseph Parkton
@hippybear
Aug 27 2016 00:05 UTC
wait till you hit the ?
that thing had me baffled for a bit
crazymaster49
@crazymaster49
Aug 27 2016 00:06 UTC
hit the what ? @hippybear
Joseph Parkton
@hippybear
Aug 27 2016 00:06 UTC
ternary operator
?
Egoscio
@Egoscio
Aug 27 2016 00:06 UTC
Remainder uses a built in modulo function, weird.
crazymaster49
@crazymaster49
Aug 27 2016 00:06 UTC
@moigithub Thanks i am still working on figuring this out.
CamperBot
@camperbot
Aug 27 2016 00:06 UTC
crazymaster49 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2015 | @moigithub |http://www.freecodecamp.com/moigithub
@Egoscio right??
A strange step from python to %
Egoscio
@Egoscio
Aug 27 2016 00:07 UTC
AH I was right about one thing, the main difference is the signs
"the difference being that the modulo operator result would take the sign of the divisor, not the dividend."
In Swift, they implemented the actual modulo function
Joseph Parkton
@hippybear
Aug 27 2016 00:08 UTC
nubs
Egoscio
@Egoscio
Aug 27 2016 00:08 UTC
I gotta think JS when I'm really a swifty :P
Joseph Parkton
@hippybear
Aug 27 2016 00:09 UTC
I want to get into swift
and go
Have to do C and Java this coming semester
not too happy about that
Egoscio
@Egoscio
Aug 27 2016 00:10 UTC
I'm coming from 2 years of fullstack javascript experience to fullstack Swift
(Web and Node.JS => Swift iOS and Vapor server side)
Very neat transition
Joseph Parkton
@hippybear
Aug 27 2016 00:10 UTC
gangster
I love node
although there is some new issue where require wont work anymore so now you have to redo all your code
Egoscio
@Egoscio
Aug 27 2016 00:11 UTC
???
the import BS?
Joseph Parkton
@hippybear
Aug 27 2016 00:11 UTC
yeah
Egoscio
@Egoscio
Aug 27 2016 00:11 UTC
(I don't like import at all)
Joseph Parkton
@hippybear
Aug 27 2016 00:12 UTC
Does it really all go back to the dude who broke the internet in 17 lines of code?
Egoscio
@Egoscio
Aug 27 2016 00:12 UTC
Still not even fully implemented AFAIK, still requires transpiling via Babel and co
nah, that's something completely different
Joseph Parkton
@hippybear
Aug 27 2016 00:12 UTC
I thought not
Cage Echarte
@CageEcharte
Aug 27 2016 00:12 UTC
I need help with this exercise, Logical Order in If Else Statements
Egoscio
@Egoscio
Aug 27 2016 00:13 UTC
Post it over, we love helping
Joseph Parkton
@hippybear
Aug 27 2016 00:13 UTC
@CageEcharte show us the code
Egoscio
@Egoscio
Aug 27 2016 00:13 UTC
@hippybear How did a NPM dependency affect the ES6 module syntax?
Joseph Parkton
@hippybear
Aug 27 2016 00:14 UTC
Code bra
that shits srs biz
Egoscio
@Egoscio
Aug 27 2016 00:14 UTC
IIRC in a couple of hours later, someone cloned the project and fixed the issue
one of the contributers
Cage Echarte
@CageEcharte
Aug 27 2016 00:14 UTC

@hippybearfunction orderMyLogic(val) {
if (val < 10) {
return "Less than 10";
} else if (val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

// Change this value to test
orderMyLogic(9);

Joseph Parkton
@hippybear
Aug 27 2016 00:15 UTC
@CageEcharte seems legit one sec
Moisés Man
@moigithub
Aug 27 2016 00:15 UTC
order matters... @CageEcharte
(async ) code run from top to bottom... and only 1 of the if /elseif blocks gets executed
soo knowing that ....
if val is 4.. what if block gets executed ????
Joseph Parkton
@hippybear
Aug 27 2016 00:16 UTC
good catch
moigithub @moigithub wonder if @CageEcharte fell asleep :sleepy: :question:
Joseph Parkton
@hippybear
Aug 27 2016 00:20 UTC
lol
this chunk array in groups is killing me lol
Im gonna get it though
BrianR
@brianrudloff
Aug 27 2016 00:24 UTC
@Egoscio Hey! one question going back to my problem. What does the ".apply(this, arguments)" mean? btw, your solution works! I just don't understand it lol
Egoscio
@Egoscio
Aug 27 2016 00:27 UTC
Back
BrianR
@brianrudloff
Aug 27 2016 00:28 UTC
hi
Egoscio
@Egoscio
Aug 27 2016 00:28 UTC
Here's the doc page
instead of doing someFunction(1, 2, 3)
you can do someFunction.apply(this, [1, 2, 3])
you can replace "this" with anything you want present as the function's this
can even be {}
In the function, arguments is an array of arguments used to execute the function, you're just passing it on synthetically
BrianR
@brianrudloff
Aug 27 2016 00:30 UTC
hmm, cool. it's going to take me a while to absorb this
Egoscio
@Egoscio
Aug 27 2016 00:30 UTC
(note: the arguments array isn't really an array, so it doesn't conform to the standard Array protocol)
Joseph Parkton
@hippybear
Aug 27 2016 00:31 UTC
Thats more node logic than pure js but it still applies
you will encounter it more in node
Egoscio
@Egoscio
Aug 27 2016 00:31 UTC
Example:
```js
oops
Joseph Parkton
@hippybear
Aug 27 2016 00:31 UTC
why is that not an array?
Walid Ashri
@walidashri
Aug 27 2016 00:31 UTC
Hello World
CamperBot
@camperbot
Aug 27 2016 00:31 UTC

welcome to FreeCodeCamp @AshriSoft!

Egoscio
@Egoscio
Aug 27 2016 00:32 UTC
Well, arguments is a wannabe array, it's an object with numbered properties
but it doesn't have stuff like .reduce or forEach (IIRC)
Joseph Parkton
@hippybear
Aug 27 2016 00:32 UTC
arr = [{some: 1},{some: 3},{some: 33}]
an array of objs
arrays are robust
Walid Ashri
@walidashri
Aug 27 2016 00:33 UTC
can someone give me the idea behind "Wherefore art thou" challenge Please
I didnt get there yet so I dunno
Egoscio
@Egoscio
Aug 27 2016 00:37 UTC
@brianrudloff
> var realArray = []
undefined
> var fakeArray
undefined
> function setFake() { fakeArray = arguments }
undefined
> setFake()
undefined
> realArray instanceof Array
true
> fakeArray instanceof Array
false
David Halls
@DavidHalls
Aug 27 2016 00:37 UTC
anyone got some pointers for pairwise?
Joseph Parkton
@hippybear
Aug 27 2016 00:37 UTC
bam!
@Byzgig never heard of it
Moisés Man
@moigithub
Aug 27 2016 00:38 UTC
ATGC ? @Byzgig
u function get called with a string.. u need to return an array of array.. with their pair
David Halls
@DavidHalls
Aug 27 2016 00:39 UTC
```
Joseph Parkton
@hippybear
Aug 27 2016 00:39 UTC
@Egoscio well yeah but after you put in your args the array will be real no?
Moisés Man
@moigithub
Aug 27 2016 00:39 UTC
if string is "AA" u return [["A","T"],["A","T"]]
T is pair of A.. (check the instructions)
David Halls
@DavidHalls
Aug 27 2016 00:39 UTC
im not on that one man
Moisés Man
@moigithub
Aug 27 2016 00:39 UTC
then ?
David Halls
@DavidHalls
Aug 27 2016 00:39 UTC
how do you post code again?
Egoscio
@Egoscio
Aug 27 2016 00:39 UTC
@hippybear Nope
Moisés Man
@moigithub
Aug 27 2016 00:39 UTC
copy paste
add backticks at start and end.. on its own line
Joseph Parkton
@hippybear
Aug 27 2016 00:40 UTC
@Egoscio splain
David Halls
@DavidHalls
Aug 27 2016 00:40 UTC
function pairwise(arr, arg) {
    var job = [];
    var select = false;
    var test = arr;

    // console.log(test);
 for(var i = 0; i < arr.length; i++){
     select = false;
     for(var j = 0; j < arr.length; j++){
         if(arr[i] + arr[j] === arg){
             job.push({one: arr.indexOf(arr[i]), two: arr.indexOf(arr[j])});
             arr[i] = false;
             arr[j] = false;
         }
     }
     console.log(arr);
     console.log(job);
 }

 //console.log(arr);

  return job.reduce(function(a, b){
      return a + b;
  });
}
pairwise([1, 3, 2, 4], 4);
Moisés Man
@moigithub
Aug 27 2016 00:40 UTC
ahh that one :)
Egoscio
@Egoscio
Aug 27 2016 00:40 UTC
@hippybear An arguments "array" is something like:
var arguments = { 0: 'firstArg', 1: 'SecondArg' }
it's not
var arguments = ['firstArg', 'SecondArg']
Joseph Parkton
@hippybear
Aug 27 2016 00:41 UTC
function doStuff(a,arr){} doStuff(1, 44) will now have an array of ["44"]
Egoscio
@Egoscio
Aug 27 2016 00:41 UTC
@brianrudloff Also, here's a little example of .apply():
> function greeting(firstName, lastName) { console.log('Hello, ' + firstName + ' ' + lastName + '!') }
undefined
> greeting('John', 'Doe')
Hello, John Doe!
undefined
> greeting.apply({}, ['John', 'Doe'])
Hello, John Doe!
undefined
>
Joseph Parkton
@hippybear
Aug 27 2016 00:41 UTC
That array resembles an object
lol
youre amazing :)
Love the examples
Egoscio
@Egoscio
Aug 27 2016 00:42 UTC
;)
A node REPL is sometimes the best way to demonstrate stuff.
Joseph Parkton
@hippybear
Aug 27 2016 00:42 UTC
true that
I love the freenode rooms for the js repl
Egoscio
@Egoscio
Aug 27 2016 00:43 UTC
I have to go now, Mention if you need me and I'll check in later
Joseph Parkton
@hippybear
Aug 27 2016 00:43 UTC
it makes some things way easier
BrianR
@brianrudloff
Aug 27 2016 00:43 UTC
@Egoscio Thank you! I think i still have a lot to learn!
CamperBot
@camperbot
Aug 27 2016 00:43 UTC
brianrudloff sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:warning: brianrudloff already gave egoscio points
Egoscio
@Egoscio
Aug 27 2016 00:43 UTC
@brianrudloff Best of luck!
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:46 UTC
function largestOfFour(arr) {
  var finalarr = [];
  for (var i = 0; i < arr.length; i++) {
     finalarr.push(Math.max.apply(Math, i));

  }

  return finalarr;

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
not working
for challenge: Return Largest Numbers in Arrays
can anyone help please?
need quick advice on what to fix in my code
David Halls
@DavidHalls
Aug 27 2016 00:47 UTC
looks like you need nested loops
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:48 UTC
ok

function largestOfFour(arr) {
  var finalarr = [];
  for (var i = 0; i < arr.length; i++) {
   for (var j = 0; j < arr.length; j++) {
    finalarr.push(Math.max.apply(Math, j));
   }
  }

  return finalarr;

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
like this?
Moisés Man
@moigithub
Aug 27 2016 00:49 UTC
@Byzgig arr.indexOf(arr[i]) will return the same value of i .. also the other one.. will return j value
soo u can just use i and j variables.. no indexOF needed
and... since ur 2 for loop using the same indice.. if u have this array [1,2,3]
and.. i and j are 0
u doing arr[0] + arr[0] --->>> if(arr[i] + arr[j] === arg){
u should NOT use the same element to make the sum calc
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:50 UTC
oh ok @moigithub

function largestOfFour(arr) {
  var finalarr = [];
  for (var i = 0; i < arr.length; i++) {
   for (var j = 0; j[i] < arr.length; j++) {
    finalarr.push(Math.max.apply(Math, j[i]));
   }
  }

  return finalarr;

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
is this what I am supposed to do? It's still outputting a empty array
Moisés Man
@moigithub
Aug 27 2016 00:52 UTC
@OmAgarwal2002 IF u gonna use math.max u only need 1 loop....
apply takes an array as argument
soo on that case.. u only need 1 loop to iterate the main array.. and "pick" the subarray
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:52 UTC
yeah
thats why i used one loop in the first place
Moisés Man
@moigithub
Aug 27 2016 00:52 UTC
i seee 2 for instructions on ur code @OmAgarwal2002
  for (var i = 0; i < arr.length; i++) {
   for (var j = 0; j[i] < arr.length; j++) {
Walid Ashri
@walidashri
Aug 27 2016 00:53 UTC
@OmAgarwal2002 still can't see any reference to arr in your code
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:54 UTC
@AshriSoft what do u mean
David Halls
@DavidHalls
Aug 27 2016 00:54 UTC
@moigithub so my question is then, how do i not use the same element twice, and then how do i add only the smallest indexes of the array?
Moisés Man
@moigithub
Aug 27 2016 00:54 UTC
@OmAgarwal2002 what data type is j cuz j[i] is wrong
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:54 UTC
@moigithub just an int
Walid Ashri
@walidashri
Aug 27 2016 00:55 UTC
@OmAgarwal2002 the second arg in apply is array I c j[i] which = nothing
Moisés Man
@moigithub
Aug 27 2016 00:55 UTC
@OmAgarwal2002 soo if j have a 0 value
and i have also 0 value ur code doing 0[0] <---is that correct ??
numbers dont have indices.... and u should access the array element instead
Walid Ashri
@walidashri
Aug 27 2016 00:56 UTC
just use one loop and ref arr[i] instead of j[i] @OmAgarwal2002
Moisés Man
@moigithub
Aug 27 2016 00:57 UTC
@Byzgig whats the purpose of ur job variable??
(and.. if thats what i think it is... ) i used an array variable to keep all the used values.. so i dont reuse it again
probably thats what ur job variable doing too..
David Halls
@DavidHalls
Aug 27 2016 00:58 UTC
@moigithub job is just pushing the indexes to an array, to be added later
@moigithub yes, that is what i ma trying, and setting the value in the og array to false so it never equals the arg again
help missing letters
CamperBot
@camperbot
Aug 27 2016 01:00 UTC
no wiki entry for: missing letters
Moisés Man
@moigithub
Aug 27 2016 01:01 UTC
@Byzgig
if(arr[i] + arr[j] === arg  && i!==j){   // compare if i is different than j.. so u not do arr[0] + arr[0]
             job.push({one: i, two: j)});
Cage Echarte
@CageEcharte
Aug 27 2016 01:02 UTC
@moigithub if val is 4 than what is "else if" ?
Moisés Man
@moigithub
Aug 27 2016 01:02 UTC
@CageEcharte sry im not following ... can u repost ur code again plz ?
order matters... @CageEcharte
(async ) code run from top to bottom... and only 1 of the if /elseif blocks gets executed
soo knowing that ....
if val is 4.. what if block gets executed ????
Cage Echarte
@CageEcharte
Aug 27 2016 01:03 UTC

@moigithubfunction orderMyLogic(val) {
if (val < 4) {
return "Less than 10";
} else if (val < 6) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

// Change this value to test
orderMyLogic(7);

Moisés Man
@moigithub
Aug 27 2016 01:03 UTC
nvm :)
Cage Echarte
@CageEcharte
Aug 27 2016 01:04 UTC
@moigithub do I need to change the other "val" ??
Moisés Man
@moigithub
Aug 27 2016 01:04 UTC
function orderMyLogic(val) {
  if (val < 10) {   
    return "Less than 10";    // first block
  } else if (val < 5) {  
    return "Less than 5";     // second block
  } else {
    return "Greater than or equal to 10";    // third block
  }
}

// Change this value to test
orderMyLogic(9);
no.. u should NOT change ur numbers... that 4 was a test value.. to check ur code logic
soo u need to "execute" ur code mentally.. and evaluate ur if condition.. vs a value
orderMyLogic( 4 ); <--- i said.. IF val is 4.. what ur code will do ??
u have 3 blocks there
soo question was .. if val is 4.. which of those 3 blocks will get executed ?
first, second or third?
what u need to do .. is just replace val with 4.. and DO the comparation the condition is doing
Cage Echarte
@CageEcharte
Aug 27 2016 01:08 UTC
@moigithub which val?
Moisés Man
@moigithub
Aug 27 2016 01:08 UTC
if (val < 10) { --->>> if (4 < 10) { and ask ur self.. is 4 less than 10 ?? is true or false???
if its true.. then u will know which block gets executed...
function orderMyLogic(val) { <--- THAT val.. ur argument variable name
soo when u execute/call ur function like this orderMyLogic( 4 ); what do u think willl be the value of val
David Halls
@DavidHalls
Aug 27 2016 01:09 UTC
thanks buddy, havent gotten it yet but progressing, @moigithub
CamperBot
@camperbot
Aug 27 2016 01:09 UTC
byzgig sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2016 | @moigithub |http://www.freecodecamp.com/moigithub
Moisés Man
@moigithub
Aug 27 2016 01:09 UTC
probably u should go back/find /read about function declarations.. what arguments are.. and how u call funcitons first @CageEcharte
not only on fcc,, but also using external resources
well.. food time...
Vishon
@Symbolistic
Aug 27 2016 01:21 UTC
can someone tell me why i keep getting "TypeError" Cannot assign to read only property '0' of string "i'm".
in this code

function titleCase(str) {
  str = str.toLowerCase();
  var newStr = str.split(' ');
  for(var i=0; i<newStr.length;i++){
      newStr[i][0] = newStr[i][0].toUpperCase();
  }
  str = newStr.join(' ');
  return str;
}

titleCase("I'm a little tea pot");
Moisés Man
@moigithub
Aug 27 2016 01:21 UTC
@Byzgig since false+1 returns 1... u also need to check if arr[i] and j are not false so it skip it
Vishon
@Symbolistic
Aug 27 2016 01:23 UTC
this is for the Title Case a Sentence challenge
i gotta make every 1st letter of each word capital
Moisés Man
@moigithub
Aug 27 2016 01:23 UTC
on Javascript strings are immutable @Symbolistic
soo u cant change part of...
u need to rebuild the whole string and reassign
(if u recall the myStr = "Jello world" exercise ) one of the very first u did
myStr[0] ="H" // fail
Vishon
@Symbolistic
Aug 27 2016 01:24 UTC
wow that sucks
and makes things a bit more confusing
Angel J Piscola
@Redmega
Aug 27 2016 01:25 UTC
@Symbolistic Makes things less confusing. Imagine treating a string like an array you can modify at will!
That's why things like split('');
exist
and .join();
Vishon
@Symbolistic
Aug 27 2016 01:32 UTC
oh i see what u meant @Redmega

function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for(var i=0; i<str.length;i++){
     str[i]=str[i].split('');
     str[i][0] = str[i][0].toUpperCase();
     str[i]=str[i].join('');
  }
  return str.join(' ');
}

titleCase("I'm a little tea pot");
took a bit of googling to figure it out
Angel J Piscola
@Redmega
Aug 27 2016 01:34 UTC
@Symbolistic Good job figuring it out :)
Vishon
@Symbolistic
Aug 27 2016 01:35 UTC
ty, pretty cool that i can break down a sentence into a word and into individual letters and target them specifically.
John Ngo
@johnngo
Aug 27 2016 01:36 UTC

function orderMyLogic(val) {
if (val < 10) {
return "Less than 10";
} else if (val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

// Change this value to test
orderMyLogic(7);
how do I get the codes to put out less then 5?

Moisés Man
@moigithub
Aug 27 2016 01:36 UTC
str[i] = str[i][0].toUpperCase()+str[i].slice(1); @Symbolistic
Angel J Piscola
@Redmega
Aug 27 2016 01:36 UTC
I'm a professional software engineer and I google at least one thing a day. It's part of the job.
help format
CamperBot
@camperbot
Aug 27 2016 01:37 UTC
no wiki entry for: format
Cage Echarte
@CageEcharte
Aug 27 2016 01:37 UTC

I'm having trouble figuring this out .......function orderMyLogic(val) {
if (val < 10) {
return "Less than 10";
} else if (val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}

// Change this value to test
orderMyLogic(7);

Angel J Piscola
@Redmega
Aug 27 2016 01:37 UTC
``
```
Vishon
@Symbolistic
Aug 27 2016 01:37 UTC
good to know since once i get a job i'll be googling at least 100 times a day :D
Angel J Piscola
@Redmega
Aug 27 2016 01:37 UTC
Why is the bot not helping me with this
Moisés Man
@moigithub
Aug 27 2016 01:37 UTC
cuz all those were removed
Angel J Piscola
@Redmega
Aug 27 2016 01:37 UTC
Why :(
@CageEcharte put three backticks before and after your code to format it into a codeblock, like so:
console.log('hello world');
Moisés Man
@moigithub
Aug 27 2016 01:38 UTC
probably they want user search on forum
all wiki moved to forum
Walid Ashri
@walidashri
Aug 27 2016 01:39 UTC
@johnngo 1 is less than 10 ur 2nd else if never in use
John Ngo
@johnngo
Aug 27 2016 01:41 UTC
I flipped the if and else if statements around and it worked
Cage Echarte
@CageEcharte
Aug 27 2016 01:42 UTC
@Redmega can you give a code example that is similar to mine
Walid Ashri
@walidashri
Aug 27 2016 01:42 UTC
@Redmega :clap:
@johnngo :clap:
Angel J Piscola
@Redmega
Aug 27 2016 01:42 UTC
Can I take your message and put it into code formatting? Sure, why not. I guess copy pasting is effort huh..
function orderMyLogic(val) {
if (val < 10) {
return "Less than 10";
} else if (val < 5) {
return "Less than 5";
} else {
return "Greater than or equal to 10";
}
}
// Change this value to test
orderMyLogic(7);
Heh, that was catty of me. Sorry.
What would happen when val is 3?
Walid Ashri
@walidashri
Aug 27 2016 01:44 UTC
return "Less than 10";
Angel J Piscola
@Redmega
Aug 27 2016 01:44 UTC
Talking to @CageEcharte , @AshriSoft . He's the one who needs help ;)
Cage Echarte
@CageEcharte
Aug 27 2016 01:45 UTC
@Redmega hey angel I'm sorry, btw how do I get my code to show up like that?
Angel J Piscola
@Redmega
Aug 27 2016 01:46 UTC
@CageEcharte put three backticks before and after your code to format it into a codeblock, like so:
console.log('hello world');
``` <-
Those are backticks
Usually to the left of your 1 key
Essaid Serhani
@purelight4ever
Aug 27 2016 01:47 UTC

I am stuck in this any help please? what I am doing wrong???``````
var count = 0;

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');```

Walid Ashri
@walidashri
Aug 27 2016 01:47 UTC
mine is on ~ key :smile:
Angel J Piscola
@Redmega
Aug 27 2016 01:47 UTC
@purelight4ever backticks must be on their own lines
@AshriSoft shift+\`` = ~, generally speaking.
Essaid Serhani
@purelight4ever
Aug 27 2016 01:48 UTC
Do you mean on each line?
Angel J Piscola
@Redmega
Aug 27 2016 01:48 UTC
``` <----
Then your code
--- > ```
Like so
Cage Echarte
@CageEcharte
Aug 27 2016 01:49 UTC
@Redmega after i put the back ticks what do I do?
Essaid Serhani
@purelight4ever
Aug 27 2016 01:49 UTC
Oh ok thank you
Moisés Man
@moigithub
Aug 27 2016 01:49 UTC
@purelight4ever dont increase/decrease count and return
make it 2 blocks...
first block increase of decrease only
then after.. evaluate count variable.. and return
Angel J Piscola
@Redmega
Aug 27 2016 01:49 UTC
three backticks. hit shift+enter. paste your code. hit shift+enter. put three more backticks.
Cage Echarte
@CageEcharte
Aug 27 2016 01:50 UTC
@johnngo thank you , you are corect
CamperBot
@camperbot
Aug 27 2016 01:50 UTC
cageecharte sends brownie points to @johnngo :sparkles: :thumbsup: :sparkles:
:cookie: 179 | @johnngo |http://www.freecodecamp.com/johnngo
roninjedi
@roninjedi
Aug 27 2016 01:51 UTC
var myStr = "FirstLine \n \ SecondLine \ \r ThirdLine"; // Change this line
ok so what excuatlly am i missing here?
Moisés Man
@moigithub
Aug 27 2016 01:51 UTC
@roninjedi remove extra spaces
instruction says.. NO spaces
roninjedi
@roninjedi
Aug 27 2016 01:51 UTC
hmm ok i didn't think the spaces mattered
Cage Echarte
@CageEcharte
Aug 27 2016 01:52 UTC

```function orderMyLogic(val) {
if (val < 5) {
return "Less than 5";
} else if (val < 10) {
return "Less than 10";
} else {
return "Greater than or equal to 10";
}
}

// Change this value to test
orderMyLogic(7);```

Essaid Serhani
@purelight4ever
Aug 27 2016 01:52 UTC
@Redmega Thank you I will try that...
CamperBot
@camperbot
Aug 27 2016 01:52 UTC
purelight4ever sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 102 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 27 2016 01:53 UTC
This message was deleted
Moisés Man
@moigithub
Aug 27 2016 01:53 UTC
This message was deleted
Angel J Piscola
@Redmega
Aug 27 2016 01:53 UTC
I give up lol...
I'll brb
AmericanPi
@AmericanPi
Aug 27 2016 01:55 UTC
Hey guys: how do i include code here? use code tags like forums? or is there a button?
Angel J Piscola
@Redmega
Aug 27 2016 01:56 UTC
three backticks before and after the code
on their own lines
Moisés Man
@moigithub
Aug 27 2016 01:56 UTC
@Redmega easier if u search on forum n copy the link :)
Angel J Piscola
@Redmega
Aug 27 2016 01:56 UTC
Seriously
I'm just about to lose my hair
Walid Ashri
@walidashri
Aug 27 2016 01:57 UTC
test
AmericanPi
@AmericanPi
Aug 27 2016 01:57 UTC
\\test2\\
friscodisco
@friscodisco
Aug 27 2016 01:57 UTC
@Redmega do you even lift bro
AmericanPi
@AmericanPi
Aug 27 2016 01:57 UTC
\\test3\\
Angel J Piscola
@Redmega
Aug 27 2016 01:57 UTC
those are backslashes, not backticks
AmericanPi
@AmericanPi
Aug 27 2016 01:57 UTC
yea no
Angel J Piscola
@Redmega
Aug 27 2016 01:57 UTC
a back tick is like an apostrophe, but fancy
`
AmericanPi
@AmericanPi
Aug 27 2016 01:58 UTC
ahhhhhh
Angel J Piscola
@Redmega
Aug 27 2016 01:58 UTC
its the same button as the tilda (~) usually
AmericanPi
@AmericanPi
Aug 27 2016 01:58 UTC
test4
Angel J Piscola
@Redmega
Aug 27 2016 01:58 UTC
single ticks for inline code, triple ticks on their own lines for block code
AmericanPi
@AmericanPi
Aug 27 2016 01:58 UTC
well i just did it but it just t
ok ill go there tx @Redmega
CamperBot
@camperbot
Aug 27 2016 01:59 UTC
americanpi sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 103 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 27 2016 01:59 UTC
normally if you type three backticks and hit shift+enter itll auto put the last ticks for you
AmericanPi
@AmericanPi
Aug 27 2016 01:59 UTC
'test'
This message was deleted
Angel J Piscola
@Redmega
Aug 27 2016 02:00 UTC
type ```. Hit shift+enter. Type your code. hit shift+enter. type ```
AmericanPi
@AmericanPi
Aug 27 2016 02:01 UTC
yea that was my problem
i couldn't put them on different lines
Angel J Piscola
@Redmega
Aug 27 2016 02:01 UTC
shift+enter for a linebreak
AmericanPi
@AmericanPi
Aug 27 2016 02:03 UTC
test
shoulda told me how to get back into chat mode LOLOLOL
Angel J Piscola
@Redmega
Aug 27 2016 02:03 UTC
ctrl+enter to submit
;)
AmericanPi
@AmericanPi
Aug 27 2016 02:04 UTC

so "ctr+/" bring up compose mode where you can type

multiple lines

like this

lets try ctrl+enter
test
Angel J Piscola
@Redmega
Aug 27 2016 02:05 UTC
Ah, I actually didn't know about compose mode
AmericanPi
@AmericanPi
Aug 27 2016 02:05 UTC
oooohhhhhhhhhhhhhhh!!!!!!!!!!!!!
Angel J Piscola
@Redmega
Aug 27 2016 02:05 UTC
I just shift+enter for line breaks
AmericanPi
@AmericanPi
Aug 27 2016 02:06 UTC
yea its in the bottom right crnewr of the text entry box
@Redmega
im out
Angel J Piscola
@Redmega
Aug 27 2016 02:06 UTC
Ciao
Tracey Bushman
@tbushman
Aug 27 2016 02:27 UTC
@Redmega (virtual beer)
Margaret
@Margaret2
Aug 27 2016 02:30 UTC
: beer : :beer:
Tracey Bushman
@tbushman
Aug 27 2016 02:31 UTC
:sweet:
Joseph
@revisualize
Aug 27 2016 02:32 UTC
Wow. This chat died.
Tracey Bushman
@tbushman
Aug 27 2016 02:33 UTC
Just in awe of @Redmega 's poise
Walid Ashri
@walidashri
Aug 27 2016 02:33 UTC
no it's on :beer: break :D
Margaret
@Margaret2
Aug 27 2016 02:34 UTC
@AshriSoft :laughing:
believeZJP
@believeZJP
Aug 27 2016 02:34 UTC
Hi,anyone pass the Pig Latin?
why I can't pass this,I think i'm right.
Azlan Mukhtar
@azlan
Aug 27 2016 02:37 UTC
@believeZJP check your code again, for example, see the result of translatePigLatin("glove");
it return 'lovegay' :D
and dont forget to read the question again, note all the requirements
SPring Run
@xcxz1994
Aug 27 2016 02:44 UTC
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
How to write it?
Vipersad
@Vipersad
Aug 27 2016 02:45 UTC
can anyone create an attendance website
or attendance app
Egoscio
@Egoscio
Aug 27 2016 02:46 UTC
@Vipersad Elaborate?
Vipersad
@Vipersad
Aug 27 2016 02:47 UTC
a attendace tracker that you scan on a barcode
it keep track on attendance
by scanning
if you can help you create and I will pay you
Egoscio
@Egoscio
Aug 27 2016 02:48 UTC
Well, this isn't much of a recruitment area. we're here to guide you on how to make it yourself ;)
Vipersad
@Vipersad
Aug 27 2016 02:49 UTC
can you please help me make it
friscodisco
@friscodisco
Aug 27 2016 02:49 UTC
I will do it for 25k
Egoscio
@Egoscio
Aug 27 2016 02:49 UTC
Do you have any programming knowledge?
lmao
Vipersad
@Vipersad
Aug 27 2016 02:49 UTC
a little bit
I just don't know how to start
please help
Alexander Køpke
@alexanderkopke
Aug 27 2016 02:52 UTC
I don't know what attendance means. I just looked it up and still I have no clue
Vipersad
@Vipersad
Aug 27 2016 02:53 UTC
its where you keep track of people who are here
such as if someone show up on in a place they either mark them preset or absent
Alexander Køpke
@alexanderkopke
Aug 27 2016 02:54 UTC
they do that on their own phone or on a device at the place
friscodisco
@friscodisco
Aug 27 2016 02:55 UTC
I will make you site like this for 30k https://www.tracksmart.com
Vipersad
@Vipersad
Aug 27 2016 02:55 UTC
3000
friscodisco
@friscodisco
Aug 27 2016 02:56 UTC
30000 USD
Vipersad
@Vipersad
Aug 27 2016 02:57 UTC
that a lot for an attendance website and I can make two social media app like Instagram for that
Egoscio
@Egoscio
Aug 27 2016 02:57 UTC
Do you know node.js? (Ever heard of it?)
Vipersad
@Vipersad
Aug 27 2016 02:58 UTC
no
friscodisco
@friscodisco
Aug 27 2016 02:58 UTC
You should hire someone from fiverr.com they can make 3 social media websites for 5 USD
Egoscio
@Egoscio
Aug 27 2016 02:58 UTC
The project you are describing requires a backend language as well (code that runs on a server, and interacts with a database)
E. Vazquez
@joufflu
Aug 27 2016 02:58 UTC
So I am reading this code: http://codepen.io/dsgnrmdy/pen/qbjEGy ... and I do not understand why the author is using a script src="http...js"
Egoscio
@Egoscio
Aug 27 2016 02:59 UTC
With node.js, you can do full stack development with a single language. http://nodejs.orh
*.org
Vipersad
@Vipersad
Aug 27 2016 03:00 UTC
ok
Egoscio
@Egoscio
Aug 27 2016 03:01 UTC
Then you need a database to store your users. Mongodb is pretty popular on the node.js world, and it's easy to start with, plenty of documentation online
Vipersad
@Vipersad
Aug 27 2016 03:01 UTC
do you know where I can find a attendance template
Egoscio
@Egoscio
Aug 27 2016 03:01 UTC
So now you have a clientside, backend, and database all powered by Javascript, awesome right?
Well, I'm not familiar with templates, if that's the path you choose to take.
THalletProtech
@THalletProtech
Aug 27 2016 03:02 UTC
i need som help on Free code camps record collection. in java script. is it ok to post code here?
Egoscio
@Egoscio
Aug 27 2016 03:02 UTC
And they tend to do a subpar job compared to actually doing something by hand with dedication
Yeah just format your code with triple backticks
'''
CamperBot
@camperbot
Aug 27 2016 03:03 UTC
:bulb: to format code use backticks! ``` more info
THalletProtech
@THalletProtech
Aug 27 2016 03:03 UTC
'''
CamperBot
@camperbot
Aug 27 2016 03:03 UTC
:bulb: to format code use backticks! ``` more info
THalletProtech
@THalletProtech
Aug 27 2016 03:03 UTC
whoops
Egoscio
@Egoscio
Aug 27 2016 03:03 UTC
(Not single quotes, back ticks)
E. Vazquez
@joufflu
Aug 27 2016 03:03 UTC
lol
Tracey Bushman
@tbushman
Aug 27 2016 03:04 UTC
@joufflu if you're writing code outside of codepen, that's where/how many include links to external scripts.
E. Vazquez
@joufflu
Aug 27 2016 03:04 UTC
little CampberBot had a few too many this evening
@tbushman gotcha
@tbushman thank you
CamperBot
@camperbot
Aug 27 2016 03:04 UTC
joufflu sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:cookie: 138 | @tbushman |http://www.freecodecamp.com/tbushman
Tracey Bushman
@tbushman
Aug 27 2016 03:04 UTC
that's a good cookie
Alexander Køpke
@alexanderkopke
Aug 27 2016 03:05 UTC
```
E. Vazquez
@joufflu
Aug 27 2016 03:06 UTC
```
joufflu @joufflu lol
THalletProtech
@THalletProtech
Aug 27 2016 03:09 UTC
shoot ill just do that
Abhijeet Phanse
@orionishere
Aug 27 2016 03:16 UTC
Hi guys... Can aanyone help me with switch statement?
Diego Mayer
@Chrono79
Aug 27 2016 03:17 UTC
@orionishere what's the problem?
Abhijeet Phanse
@orionishere
Aug 27 2016 03:20 UTC

@Chrono79 here is my code ````
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
val = 1;
console.log("alpha");
break;

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

// Change this value to test
caseInSwitch(1);
```

the message I get is unexpected break....
Egoscio
@Egoscio
Aug 27 2016 03:21 UTC
I don't see any switch's
Diego Mayer
@Chrono79
Aug 27 2016 03:21 UTC
@orionishere look at the pseudocode example:
switch (num) {
  case value1:
    statement1;
    break;
  case value2:
    statement2;
    break;
...
  case valueN:
    statementN;
    break;
}
you have to use the same structure
Also read mdn page for more examples and longer explanation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
THalletProtech
@THalletProtech
Aug 27 2016 03:24 UTC
function updateRecords(id, prop, value) {

  if(collection.hasOwnProperty(id)){

    if (prop == "tracks"){ 

        if (value === "" && collection[id].hasOwnProperty(prop)){
          collection[id][prop].push(value);
        }else if(value === "" && collection[id].hasOwnProperty(prop) === false){
          collection[id][prop]= [value];
        }else{
          delete collection[id][prop];
        }

    }else{ 

        if(value === ""){
          collection[id][prop] = value;
        }else{
          delete collection[id][prop];
        }
    }
  }
  return collection;
}
Abhijeet Phanse
@orionishere
Aug 27 2016 03:25 UTC
I went through it.... I have more doubts now.... @Chrono79
Diego Mayer
@Chrono79
Aug 27 2016 03:25 UTC
@THalletProtech that's wrong, you have to delete the property if value is empty string
Abhijeet Phanse
@orionishere
Aug 27 2016 03:25 UTC
I've changed the code according to structure....
Diego Mayer
@Chrono79
Aug 27 2016 03:26 UTC
let's see it
nicop
@nicopcat
Aug 27 2016 03:26 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

// Your code above this line
return result;
}

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

Abhijeet Phanse
@orionishere
Aug 27 2016 03:26 UTC
function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
    case 1:
  console.log("alpha");
  break;
  }
  // Only change code above this line  
  return answer;  
}

// Change this value to test
caseInSwitch(1);
THalletProtech
@THalletProtech
Aug 27 2016 03:26 UTC
@Diego Mayer is that not what i am doing
nicop
@nicopcat
Aug 27 2016 03:27 UTC
dont know what does it want me to do
Diego Mayer
@Chrono79
Aug 27 2016 03:27 UTC
@THalletProtech no
@orionishere that's almost ok (but incomplete), you have to change answer value instead of using console.log, add the other cases too
Abhijeet Phanse
@orionishere
Aug 27 2016 03:28 UTC
I just wanted to check first with one case... so I just put in code for one case... However I've tried with full code.... not working.... @Chrono79
Norvin Burrus
@ndburrus
Aug 27 2016 03:28 UTC
@nicopcat the exercise is asking for a sentence to be built using the 4 word types given. it may be easiest to begin by making a complete (spacing & punctuation) sentence, using the 4 words. to make sense, the complete sentence will require a few "filler" words. :sparkles:
Diego Mayer
@Chrono79
Aug 27 2016 03:28 UTC
@orionishere do the change I told you, your function returns answer, set its value in each case
THalletProtech
@THalletProtech
Aug 27 2016 03:31 UTC
im not sure what you mean diego
Abhijeet Phanse
@orionishere
Aug 27 2016 03:34 UTC
thanks @Chrono79 .... i was able to do it.....
CamperBot
@camperbot
Aug 27 2016 03:34 UTC
orionishere sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1923 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Aug 27 2016 03:34 UTC
@THalletProtech
function updateRecords(id, prop, value) {

  if(collection.hasOwnProperty(id)){

    if (prop == "tracks"){ 

        if (value === "" && collection[id].hasOwnProperty(prop)){ 
          collection[id][prop].push(value); // if value is "" you should delete the property, you're not doing that here
        }else if(value === "" && collection[id].hasOwnProperty(prop) === false){
          collection[id][prop]= [value]; // or here
        }else{
          delete collection[id][prop];
        }

    }else{ 

        if(value === ""){
          collection[id][prop] = value; // here either
        }else{
          delete collection[id][prop]; //here you shouldn't delete the property
        }
    }
  }
  return collection;
}
@orionishere :+1:
nicop
@nicopcat
Aug 27 2016 03:40 UTC
@ndburrus still dont know how to type T T
can u gimme an example
Essaid Serhani
@purelight4ever
Aug 27 2016 03:44 UTC
blob
coffeebeanzz
@coffeebeanzz
Aug 27 2016 03:45 UTC
@nicopcat result=myNoun + " " + myAdjective + " " + and keep going. Be sure to put actual spaces between the quotes
This message was deleted
Diego Mayer
@Chrono79
Aug 27 2016 03:46 UTC
@purelight4ever separate card evaluation of count evaluation, return only in the last one
Essaid Serhani
@purelight4ever
Aug 27 2016 03:46 UTC
```
How can I do that please?
Diego Mayer
@Chrono79
Aug 27 2016 03:48 UTC
@purelight4ever do two separate if/else blocks
Don't return when evaluating card, only change count value there
THalletProtech
@THalletProtech
Aug 27 2016 03:50 UTC
@Chrono79 how i send you points?
Essaid Serhani
@purelight4ever
Aug 27 2016 03:50 UTC
@Chrono79 I will try that... Thank you
CamperBot
@camperbot
Aug 27 2016 03:50 UTC
purelight4ever sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1924 | @chrono79 |http://www.freecodecamp.com/chrono79
bibubi
@bibubi
Aug 27 2016 03:52 UTC
@purelight4ever
blob
Diego Mayer
@Chrono79
Aug 27 2016 03:54 UTC
THalletProtech just saying thanks and mentioning me
Essaid Serhani
@purelight4ever
Aug 27 2016 03:55 UTC
@bibubi Thank you so much... I wasted so much time trying to figure it out....!!!
CamperBot
@camperbot
Aug 27 2016 03:55 UTC
purelight4ever sends brownie points to @bibubi :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for bibubi
Diego Mayer
@Chrono79
Aug 27 2016 03:55 UTC
@bibubi that's a weird way of doing it but maybe it works ;)
Essaid Serhani
@purelight4ever
Aug 27 2016 03:56 UTC
@camperbot How can I do that? (I am new here!!)
bibubi
@bibubi
Aug 27 2016 03:57 UTC
:smile:
nicop
@nicopcat
Aug 27 2016 03:58 UTC
@coffeebeanzz @Chrono79 @ndburrus thank you so much :sparkles:
CamperBot
@camperbot
Aug 27 2016 03:58 UTC
nicopcat sends brownie points to @coffeebeanzz and @chrono79 and @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1010 | @coffeebeanzz |http://www.freecodecamp.com/coffeebeanzz
:star2: 1902 | @ndburrus |http://www.freecodecamp.com/ndburrus
:star2: 1925 | @chrono79 |http://www.freecodecamp.com/chrono79
coffeebeanzz
@coffeebeanzz
Aug 27 2016 03:59 UTC
you're welcome @nicopcat :)
Norvin Burrus
@ndburrus
Aug 27 2016 03:59 UTC
@nicopcat you're welcome! :palm_tree:
Diego Mayer
@Chrono79
Aug 27 2016 04:07 UTC
bye
Norvin Burrus
@ndburrus
Aug 27 2016 04:20 UTC
@purelight4ever :sparkles:
Mike
@SaxManMike
Aug 27 2016 04:39 UTC
Hi all, I'm struggling to wrap my brain around introducing a Twitter widget to my quote generator. I could use a hand if anyone's available.
Suzanne Atkinson
@AdventureBear
Aug 27 2016 04:46 UTC
Pairwise falls to @adventurebear!
Daniel Wu
@mejorna
Aug 27 2016 04:50 UTC

i'm stuck on the Seek and Destroy challenge. I looked at all the references on MDN, w3schools , and tutorialspoint.com. can someone give me a hint?
```javascript function destroyer(element, index, array) {
return (element != arguments[1]);
}

var filtered = array.filter(destroyer);

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

Tracey Bushman
@tbushman
Aug 27 2016 05:01 UTC
@mejorna I am sorry, I am stuck on that one too. I don't understand the whole arguments functions back-and-forth. :(
@SaxManMike the url 'http://twitter.com/share?' plus whatever text.
FreddySun
@sunpeng897570
Aug 27 2016 05:02 UTC
@mejorna destroyer is a function,how coud you make it as a argument
Mike
@SaxManMike
Aug 27 2016 05:04 UTC
@tbushman I'm not sure what you mean.
Daniel Wu
@mejorna
Aug 27 2016 05:06 UTC
@sunpeng897570 how did i make it an argument?
Tracey Bushman
@tbushman
Aug 27 2016 05:06 UTC
Once you've got the quote text, you can set the html attribute of the button to the twitter share url, appending the quote text after the question mark.
err href attribute
Mike
@SaxManMike
Aug 27 2016 05:07 UTC
Do I need to include any other code in the JS section to make it work?
Daniel Wu
@mejorna
Aug 27 2016 05:07 UTC
Tracey Bushman
@tbushman
Aug 27 2016 05:08 UTC
@SaxManMike si. When I did mine, I removed the twitter share button each time the new quote was generated. Then, when the new quote was appended, a new twitter button with the quote text was appended back
one thing , for dynamically-added buttons , you need to use $(document).on('click', '#buttonid', function(){}); instead of $('#buttonid').click(); ... remember that if poss.
Mike
@SaxManMike
Aug 27 2016 05:16 UTC
Why is that?
Tracey Bushman
@tbushman
Aug 27 2016 05:18 UTC
Something about how the dom won't recognize it immediately .. it's just something I found out once after almost crying about a proj.
Mike
@SaxManMike
Aug 27 2016 05:18 UTC
Well then, I appreciate the saved tears :)
Tracey Bushman
@tbushman
Aug 27 2016 05:19 UTC
sorry, I meant $(document).on('click', '#buttonid', function(){...}); instead of $('#buttonid').click(function(){...});
benedict
@benz12
Aug 27 2016 05:21 UTC

var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a += a + 12 ;
b += 9 + b ;
c += c + 7 ;

whats wrong with my code please help.

Compound Assignment With Augmented Addition
Mike
@SaxManMike
Aug 27 2016 05:22 UTC
Remove the a on the right side of the += sign
Same with all variables to the right, you don't need them with the +=
Nope, sorry, that's wrong...I'm tired :P
@tbushman This is what I wrote, it doesn't quite seem to work...
$(document).on('click','#tweet', function(inspiration){
$("#tweet").attr("href", 'https://twitter.com/intent/tweet?hashtags=inspired&text=' + inspiration);
});
Inspiration is the variable with the quote
Tracey Bushman
@tbushman
Aug 27 2016 05:26 UTC
The href attr needs to be changed before it is clicked
or you could do window. (load?) something-or-other. I'd have to look that up
Mike
@SaxManMike
Aug 27 2016 05:27 UTC
window.open?
Tracey Bushman
@tbushman
Aug 27 2016 05:27 UTC
sounds right. I think so
Edmund To
@edmundtfy
Aug 27 2016 05:28 UTC
Hello Does anyone use React? I can't figure out its behaviour...
I use React to trigger Bootstrap modal --> include some input field
The problem is whenever I click on those input field, I cannot scroll anywhere anymore...
any idea?
Mike
@SaxManMike
Aug 27 2016 05:29 UTC
Oooooo, so close! It isn't passing my variable for some reason
Oooooo, so close! It isn't passing my variable for some reason
It says "[object Object]"
Is that because my inspiration variable is private as part of the quote function?
function quoteText () {
var num = Math.floor( Math.random() * quotes.length);
inspiration = quotes[num];
return inspiration;
}
Tracey Bushman
@tbushman
Aug 27 2016 05:33 UTC
what does console.log(num) tell u?
Mike
@SaxManMike
Aug 27 2016 05:36 UTC
That it's undefined?
Vivienne Sales
@Natto278
Aug 27 2016 05:37 UTC
This message was deleted
'''
CamperBot
@camperbot
Aug 27 2016 05:37 UTC
:bulb: to format code use backticks! ``` more info
Edmund To
@edmundtfy
Aug 27 2016 05:38 UTC
Hello, does anybody use React? @SaxManMike @tbushman
Tracey Bushman
@tbushman
Aug 27 2016 05:38 UTC
@edmundtfy I haven't gotten into React just yet. sooon. sorry
Edmund To
@edmundtfy
Aug 27 2016 05:38 UTC
@tbushman never mind ^_^
Tracey Bushman
@tbushman
Aug 27 2016 05:39 UTC
@edmundtfy one thing, pointer-events: auto; vs. pointer-events: none; is a thing to investigate sometimes (css) on things like scrolling probs
Vivienne Sales
@Natto278
Aug 27 2016 05:39 UTC

Hello. I'm stuck on item #5 of the Profile Lookup challenge. What am I doing wrong? ```for (var i=0; i < contacts.length; i++) {
if (contacts[i].firstName == firstName)
if ( contacts[i][prop] )
return contacts[i][prop];
} //items #1-#3 work
{ return "No such contact"; } //item #4 works

if (contacts[i].hasOwnProperty(prop) === false )
return "No such property";

Tracey Bushman
@tbushman
Aug 27 2016 05:40 UTC
@SaxManMike you're missing the last part of the math.random deal
Math.floor(Math.random() * (max - min)) + min;
so your num var is out of range
maybe
Michael Karpinski
@karpimpski
Aug 27 2016 05:41 UTC
hey guys, I just discovered querySelector. can anybody tell me the difference between querySelector/querySelectorAll and getElementById/getElementsByClassName? it seems like querySelector is more useful, but please let me know if I'm wrong
Edmund To
@edmundtfy
Aug 27 2016 05:43 UTC
@tbushman thanks, investigating on that!
CamperBot
@camperbot
Aug 27 2016 05:43 UTC
edmundtfy sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:cookie: 140 | @tbushman |http://www.freecodecamp.com/tbushman
Tracey Bushman
@tbushman
Aug 27 2016 05:44 UTC
@Natto278 on the last if statement, the '===false' cancels out the .hasOwnProperty() statement, I think
so it becomes if (false === false)
Mike
@SaxManMike
Aug 27 2016 05:47 UTC
@tbushman Isn't the min 0, so when you simplify the equation you get what I had?
Tracey Bushman
@tbushman
Aug 27 2016 05:47 UTC
I was just guessing and haven't looked too closely , sorry
Vivienne Sales
@Natto278
Aug 27 2016 05:47 UTC
@tbushman So I need to rewrite that last if statement. Also, I think I messed up posting my code using markup. I know it's ``` <shift><enter> Paste your code <shift><enter>. But I get the last couple of commands messed up. What am I doing wrong?
Tracey Bushman
@tbushman
Aug 27 2016 05:49 UTC

so do
shift enter
then add

then shift enter

shift-enter gives line breaks between ```s

Vivienne Sales
@Natto278
Aug 27 2016 05:49 UTC
Like this?
```
Tracey Bushman
@tbushman
Aug 27 2016 05:49 UTC
si
Vivienne Sales
@Natto278
Aug 27 2016 05:50 UTC
@tbushman I left those directions at home. I'm sorry.
Tracey Bushman
@tbushman
Aug 27 2016 05:51 UTC
so if you did those ticks, then shift-entered, then pasted code, then shift entered again, and added closing ticks, ... it's a recurring issue on here. One poor man earlier almost pulled his hair out explaining
Henry Cabello
@hacu9
Aug 27 2016 05:52 UTC
Hello,guys i got a question,heres my code :
function titleCase(str) {
var lowCase = str.toLowerCase();
var result = lowCase.replace((/\b\w/g), function(l){
return l.toUpperCase();
});
console.log(result);
return result;
}
I'M A Little Tea Pot
Vivienne Sales
@Natto278
Aug 27 2016 05:52 UTC

@tbushman I rewrote my code but it's still not working. ```for (var i=0; i < contacts.length; i++) {
if (contacts[i].firstName == firstName)
if ( contacts[i][prop] )
return contacts[i][prop];
} //items #1-#3 work
{ return "No such contact"; } //item #4 works

{
if (contacts[i][prop] === false)
return "No such property";
}
```

Michael Karpinski
@karpimpski
Aug 27 2016 05:52 UTC
@hacu9 help formatting
help format
CamperBot
@camperbot
Aug 27 2016 05:52 UTC
no wiki entry for: format
Michael Karpinski
@karpimpski
Aug 27 2016 05:52 UTC
man i can't remember what the wiki entry is
@hacu9 use three `s to outline your code.
Tracey Bushman
@tbushman
Aug 27 2016 05:53 UTC
@Natto278 I was going to say, if you remove the '===false', then the statement has the reverse meaning and you'd need to switch the content between {}s
Mike
@SaxManMike
Aug 27 2016 05:54 UTC
@tbushman Would you be willing to take a look at my JS and see why the variable isn't passing to the Tweet?
Vivienne Sales
@Natto278
Aug 27 2016 05:54 UTC
@tbushman Are you saying that for then first post of my code today?
Tracey Bushman
@tbushman
Aug 27 2016 05:54 UTC
@Natto278 I would write 'if (contacts[i][prop] == 'null')' ...try that or == 'undefined' ... use console.log() to test
Henry Cabello
@hacu9
Aug 27 2016 05:55 UTC
@karpimpski I'M A Little Tea Pot
I need M to be lowercase
Tracey Bushman
@tbushman
Aug 27 2016 05:56 UTC
@SaxManMike k momento
@Natto278 I'm not sure what post ?
Mike
@SaxManMike
Aug 27 2016 05:56 UTC
@tbushman Thanks for all your help, this has been very instructive! I appreciate you not spoon feeding me the answer
CamperBot
@camperbot
Aug 27 2016 05:56 UTC
saxmanmike sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:cookie: 141 | @tbushman |http://www.freecodecamp.com/tbushman
Vivienne Sales
@Natto278
Aug 27 2016 05:58 UTC
@tbushman I tried both of your suggestions, but it's still not working.
for (var i=0; i < contacts.length; i++) {
  if (contacts[i].firstName == firstName)
    if ( contacts[i][prop] )
      return contacts[i][prop];
} //items #1-#3 work
  { return "No such contact"; } //item #4 works

{ 
  if (contacts[i][prop] === "null")
    return "No such property";
}
```
Tracey Bushman
@tbushman
Aug 27 2016 05:59 UTC
@hacu9 which exercise is that?
Henry Cabello
@hacu9
Aug 27 2016 06:00 UTC
@tbushman Title Case a Sentence
function titleCase(str) { var lowCase = str.toLowerCase(); var result = lowCase.replace((/\b\w/g), function(l){ return l.toUpperCase(); }); console.log(result); return result; }
Tracey Bushman
@tbushman
Aug 27 2016 06:02 UTC
@SaxManMike you're trying to append a function to $('#quoteMe') ... when quoteText could be a variable insteat of a function
bibubi
@bibubi
Aug 27 2016 06:03 UTC
function titleCase(str) {
var str1=str.split(" ");
var str2=str1.map(function(val){
return val.toLowerCase().replace(/\w/,val.charAt(0).toUpperCase());
});
return str2.join(" ");
}
Tracey Bushman
@tbushman
Aug 27 2016 06:04 UTC
@SaxManMike see what I mean? Just put var inspiration in your div instead of quoteText, and remove the quoteText function, is what I would try

@hacu9 you can just do

lowCase.replace(..).toUpperCase();

I think

Mike
@SaxManMike
Aug 27 2016 06:07 UTC
I think I see what you mean, I just need to figure out the syntax
nicop
@nicopcat
Aug 27 2016 06:07 UTC

function queue(arr, item) {
// Your code here

return item; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

return what?
Tracey Bushman
@tbushman
Aug 27 2016 06:08 UTC
@Natto278
for (var i=0; i < contacts.length; i++) {
if (contacts[i].firstName == firstName)
if ( contacts[i][prop] )
return contacts[i][prop];
} //items #1-#3 work
{ return "No such contact"; } //item #4 works

{
if (contacts[i][prop] === false) // THis , if 'null', reads 'if (null === false)'

return "No such property";
}
Henry Cabello
@hacu9
Aug 27 2016 06:09 UTC
@tbushman lowCase.replace(/\b\w/g).toUpperCase();
i still get I'M A Little Tea Pot, it should be "I'm A Little Tea Pot
Tracey Bushman
@tbushman
Aug 27 2016 06:09 UTC
@Natto278 ... but I haven't worked on that exercise and I just had a similar issue with an if statement yesterday... kind of guessing. sorry
@hacu9 right. I remember having the same issue, but I can't remember which exercise. Which is it called?
Henry Cabello
@hacu9
Aug 27 2016 06:10 UTC
Title Case a Sentence
i think i just need to add something to the regex
Mike
@SaxManMike
Aug 27 2016 06:11 UTC
Well, I got the code working more cleanly, but the Tweeting still isn't working
Henry Cabello
@hacu9
Aug 27 2016 06:11 UTC
but idk what so it ignores the '
Tracey Bushman
@tbushman
Aug 27 2016 06:12 UTC
@hacu9 oh ok. Then you were on the right track. I am sorry. One moment. It's something about adding parentheses to the regexp
@hacu9 sorry. I was wrong. Go back to how you had it because you need the function as a replacer for the regex. Do that first. Accept my apologies. :P
Mike
@SaxManMike
Aug 27 2016 06:14 UTC
@tbushman Did I mess up the syntax on my Tweeting code?
Henry Cabello
@hacu9
Aug 27 2016 06:15 UTC
@tbushman its alright,thanks i appreciate help :P i just cant figure out how to ignore the '
Tracey Bushman
@tbushman
Aug 27 2016 06:17 UTC
@hacu9 Yeah, I'm looking at my soln and I replaced the " ' " with an underscore, then replaced the underscore with " ' " at the end. Totally hack-y.
Mike
@SaxManMike
Aug 27 2016 06:19 UTC
@tbushman I fixed the JS code so you don't have to scroll for a thousand years to get to the code I'm working on
Tracey Bushman
@tbushman
Aug 27 2016 06:20 UTC
@SaxManMike maybe try removing 'inspiration' from function(inspiration) ? Did I mention I was an art major ? I'm not sure :P All guesses tonight.
Mike
@SaxManMike
Aug 27 2016 06:22 UTC
@tbushman haha! Well, looks like I'm stuck for tonight then. I was a music major and there's no way I'm wrapping my brain around this tonight
Tracey Bushman
@tbushman
Aug 27 2016 06:22 UTC
Music is Math — (Boards of Canada) == good album;
CamperBot
@camperbot
Aug 27 2016 06:23 UTC
Mike
@SaxManMike
Aug 27 2016 06:23 UTC
Whatever, @camperbot
Tracey Bushman
@tbushman
Aug 27 2016 06:24 UTC
I'm starting to chat like CamperBot, which means I should retire. Best wishes y'all.
Mike
@SaxManMike
Aug 27 2016 06:25 UTC
Thanks @tbushman !
CamperBot
@camperbot
Aug 27 2016 06:25 UTC
saxmanmike sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:warning: saxmanmike already gave tbushman points
Vivienne Sales
@Natto278
Aug 27 2016 06:26 UTC
@tbushman At my local FCC meeting this afternoon, one of the campers helped me solve the Profile Lookup challenge. You were right. Some of my 'if' statements were written backwards! Thank you for your help!
CamperBot
@camperbot
Aug 27 2016 06:26 UTC
natto278 sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:cookie: 142 | @tbushman |http://www.freecodecamp.com/tbushman
Tracey Bushman
@tbushman
Aug 27 2016 06:27 UTC
@Natto278 oh good .. someone yesterday pointed out where I had done a similar thing , and so I threw that out there :)
greg
@wearenotgroot
Aug 27 2016 06:29 UTC
@Natto278 @tbushman use .hasOwnProperty if you want to test if a property exist or not
docs
Indhu
@Indhusethu
Aug 27 2016 06:30 UTC
need help in escaping literals
js var myStr="Here is a backslash: \\.\n\t\tHere is a new line with two tabs.";// Cha
greg
@wearenotgroot
Aug 27 2016 06:31 UTC

@Natto278 and this two, you can just do an if else instead

if ( contacts[i][prop] )
return contacts[i][prop];
}
if (contacts[i][prop] === false) // THis , if 'null', reads 'if (null === false)'

return "No such property";
}

since you are testing if the property exist. if it does return the value from the lookup else return No such property


if contact in the ith index hasOwnProperty prop
    //return value from the lookup
else
      //return "No such property"
Indhu
@Indhusethu
Aug 27 2016 06:32 UTC
anyone please?
js var myStr="Here is a backslash: \\.\n\t\tHere is a new line with two tabs.";
greg
@wearenotgroot
Aug 27 2016 06:33 UTC
@Indhusethu no spaces on the : and \\
Indhu
@Indhusethu
Aug 27 2016 06:34 UTC
oh ok @wearenotgroot
greg
@wearenotgroot
Aug 27 2016 06:34 UTC
@Indhusethu oh no there was space :smile:
Indhu
@Indhusethu
Aug 27 2016 06:35 UTC
js var myStr="Here is a backslash:\\.\n\t\tHere is a new line with two tabs.";
am i right now?
greg
@wearenotgroot
Aug 27 2016 06:36 UTC
@Indhusethu nvm
Indhu
@Indhusethu
Aug 27 2016 06:37 UTC
nvm??
bibubi
@bibubi
Aug 27 2016 06:37 UTC
blob
greg
@wearenotgroot
Aug 27 2016 06:38 UTC
@Indhusethu you are working on this right? Escape Sequences in Strings
Indhu
@Indhusethu
Aug 27 2016 06:39 UTC
yes
greg
@wearenotgroot
Aug 27 2016 06:39 UTC
@Indhusethu try and reset it because they changed that challenge
Indhu
@Indhusethu
Aug 27 2016 06:39 UTC
oh no!!:(
greg
@wearenotgroot
Aug 27 2016 06:39 UTC
@Indhusethu you should have this (new text)
  • FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
Indhu
@Indhusethu
Aug 27 2016 06:42 UTC
yeah i saw just now :)
greg
@wearenotgroot
Aug 27 2016 06:42 UTC
@Indhusethu :+1:
Indhu
@Indhusethu
Aug 27 2016 06:42 UTC
thanks for ur time:) :+1: @wearenotgroot
CamperBot
@camperbot
Aug 27 2016 06:42 UTC
indhusethu sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1469 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Indhu
@Indhusethu
Aug 27 2016 06:43 UTC
i got it
greg
@wearenotgroot
Aug 27 2016 06:43 UTC
@Indhusethu np
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 06:59 UTC
Screen Shot 2016-08-27 at 13.59.10.png
What should I do now? Please help.
greg
@wearenotgroot
Aug 27 2016 07:01 UTC
@Sohan2infoSec hint! which array method did you use in the previous challenges that added an item in an array?
@Sohan2infoSec here is the docs for Array, you can searh for methods that will fullfill those requirements from the challenge
Array
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 07:04 UTC
I’ll try.
greg
@wearenotgroot
Aug 27 2016 07:05 UTC
@Sohan2infoSec another thing do not declare a variable same name as your function arguments
function nextInLine(arr,item){
   var arr = [1,2]; //<-----------that has the same name as you function argument arr(will overwrite and cause confusion)
    return item;
}
kunal
@kunal47
Aug 27 2016 07:06 UTC

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case "alpha" :
return answer;
break;
case "beta" :
return answer;
break;
case "gamma" :
return answer;
break;
case "delta" :
return answer;
break;
}

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

// Change this value to test
caseInSwitch(1);

what is the error
greg
@wearenotgroot
Aug 27 2016 07:07 UTC
@kunal47 no return statement inside the switch, just assign the value to answer variable
kunal
@kunal47
Aug 27 2016 07:09 UTC
ok thanks
greg
@wearenotgroot
Aug 27 2016 07:09 UTC
@kunal47 another thing your case should be numbers, example
case 1 : ....(value of answer should be "alpha")
kunal
@kunal47
Aug 27 2016 07:10 UTC
ok
Michael Karpinski
@karpimpski
Aug 27 2016 07:18 UTC
hi guys, I have a problem making a mouseover animation. it works the way I want, but it's very clippy. here's my code:
for(var j = 0; j < boxes.length; j++){
    var interval;
    var outInterval;
    boxes[j].addEventListener('mouseover',function(){
        var percent = -0.005;
        var t = this;
        clearInterval(outInterval);
        interval = setInterval(function(){
            t.style.background = shadeColor(boxColor, percent);
            if(percent >= -0.1){
                percent -= 0.005;
            }
        }, 10);
    });
    boxes[j].addEventListener('mouseout',function(){
        var percent = -0.1;
        var t = this;
        clearInterval(interval);
        outInterval = setInterval(function(){
            t.style.background = shadeColor(boxColor, percent);
            if(percent <= 0){
                percent += 0.005;
            }
        }, 10);
        this.style.background = boxColor;
    });
}
by "clippy" I mean whenever you move the mouse, it runs the mouseOut function
jamesmillerho
@jamesmillerho
Aug 27 2016 07:19 UTC
hi
Liew Xun
@damakuno
Aug 27 2016 07:21 UTC
@jamesmillerho the effect can, the on click event, no
jamesmillerho
@jamesmillerho
Aug 27 2016 07:23 UTC
@damakuno so is it possible to do the same page with only CSS
Liew Xun
@damakuno
Aug 27 2016 07:24 UTC
no
jamesmillerho
@jamesmillerho
Aug 27 2016 07:24 UTC
@damakuno ok thanks
CamperBot
@camperbot
Aug 27 2016 07:24 UTC
jamesmillerho sends brownie points to @damakuno :sparkles: :thumbsup: :sparkles:
:cookie: 39 | @damakuno |http://www.freecodecamp.com/damakuno
Liew Xun
@damakuno
Aug 27 2016 07:25 UTC
as far as I know, @jamesmillerho css only has on hover, and on active events
that means it'll do something while the mouse is on the button
but it doesn't handle a click
that's why you can do something like a dropdown list with pure css
but not a toggled menu like that
i mean drop down menu
jamesmillerho
@jamesmillerho
Aug 27 2016 07:36 UTC
why -webkit-filter is not working
I want to -webkit-filter: blur
I use Chrome
Anthony Drane
@Antiaccess
Aug 27 2016 07:36 UTC
Can anyone tell me why I'm not getting any return on the console.log statement in the following (for Caesar's Cypher challenge/ shifting letters 13 places)
function rot13(str) {
  //str = str.split('');
  var rot13 = "";
  for (var i = 0; i < str.length; i++){
    if (90 >= str.charCodeAt(i) >= 65){
        if (str.charCodeAt(i) < 78){
            console.log(String.fromCharCode(str.charCodeAt(i)+13));
            rot13 += String.fromCharCode(str.charCodeAt(i)+13);
        } else {
            var num = 90 - str.charCodeAt(i);
            rot13 += String.fromCharCode(65+num);
        }
    } else {
        rot13 += str[i];
    }
}
  return rot13;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
(AKA it's empty)
jamesmillerho
@jamesmillerho
Aug 27 2016 07:42 UTC
@Antiaccess str[i].charCodeAt(0)
Anthony Drane
@Antiaccess
Aug 27 2016 07:46 UTC
I'm not following @jamesmillerho
jamesmillerho
@jamesmillerho
Aug 27 2016 07:49 UTC
@Antiaccess 90 >= str.charCodeAt(i) && str.charCodeAt(i) >= 65
@Antiaccess You can't write90 >= str.charCodeAt(i) >= 65
now it logs
Winter S. Ndolo
@xulenvirp
Aug 27 2016 07:55 UTC
@jamesmillerho do you know how to escape sequences in strings
Here is the text with the escape sequences written out.

"FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine"
this my current code
below
Sandeep
@SandeepSafalta
Aug 27 2016 07:56 UTC
use escape(varname) to escape a string from a sequence
Winter S. Ndolo
@xulenvirp
Aug 27 2016 07:56 UTC
@SandeepSafalta how do i put esacpe (varname) in this code
var myStr;

myStr = "Firstline\nSecondline\\\Thirdline";

// Change this line
or where do i put it?
Sandeep
@SandeepSafalta
Aug 27 2016 07:57 UTC
escape(myStr);
jamesmillerho
@jamesmillerho
Aug 27 2016 07:58 UTC
@xulenvirp var myStr = "FirstLine\n\\SecondLine\\\rThirdLine";
Winter S. Ndolo
@xulenvirp
Aug 27 2016 07:58 UTC
oh. Thanks @jamesmillerho @SandeepSafalta
Sandeep
@SandeepSafalta
Aug 27 2016 07:58 UTC
puth this below the variable declaration
CamperBot
@camperbot
Aug 27 2016 07:58 UTC
:cookie: 9 | @sandeepsafalta |http://www.freecodecamp.com/sandeepsafalta
:cookie: 401 | @jamesmillerho |http://www.freecodecamp.com/jamesmillerho
xulenvirp sends brownie points to @jamesmillerho and @sandeepsafalta :sparkles: :thumbsup: :sparkles:
Sandeep
@SandeepSafalta
Aug 27 2016 08:00 UTC
may i say something to shaw @ xulen
i am new in coding i just started from this morning
Winter S. Ndolo
@xulenvirp
Aug 27 2016 08:01 UTC
so am I but i started on Wednesday @SandeepSafalta
Sandeep
@SandeepSafalta
Aug 27 2016 08:01 UTC
but i have previous programming experience
hey shaw can i ask you something
Darth Skywalker
@adityaparab
Aug 27 2016 08:03 UTC
@xulenvirp : Welcome! :P
@SandeepSafalta : You too :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:04 UTC
currently i am working on yii framework
i am stuck on it
have 3 bug in my code
Darth Skywalker
@adityaparab
Aug 27 2016 08:04 UTC
Lifes' too short to be still using php :P
Egoscio
@Egoscio
Aug 27 2016 08:04 UTC
^
At least go with node.
Sandeep
@SandeepSafalta
Aug 27 2016 08:05 UTC
man i am new in js dev env
college taught us php
Egoscio
@Egoscio
Aug 27 2016 08:05 UTC
Node is JS :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:05 UTC
i know what is js dont act smart
Darth Skywalker
@adityaparab
Aug 27 2016 08:05 UTC
Let me guess, the async philosophy of js is what pisses you off! :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:05 UTC
i know some basic of js
Egoscio
@Egoscio
Aug 27 2016 08:05 UTC
Acting smart? Alright then
Darth Skywalker
@adityaparab
Aug 27 2016 08:06 UTC
Calm down, men! No need to be adversaries here!
Egoscio
@Egoscio
Aug 27 2016 08:06 UTC
True, I have better places to invest such an act.
Sandeep
@SandeepSafalta
Aug 27 2016 08:07 UTC
i have knowledge about what js node and other library do but only thing that remained is i dont know coding in js properly its totally new to me
no -offence friends
offend
*
Darth Skywalker
@adityaparab
Aug 27 2016 08:09 UTC
'no' is not recognized as an internal or external command,
operable program or batch file.
Sandeep
@SandeepSafalta
Aug 27 2016 08:09 UTC
oh no
Egoscio
@Egoscio
Aug 27 2016 08:09 UTC
Give it a sec to reboot...
Darth Skywalker
@adityaparab
Aug 27 2016 08:10 UTC
no -offence friends looks like a command, which means you're passing in a parameter called -offence and then you tell it who to offend - friends
:D
Sandeep
@SandeepSafalta
Aug 27 2016 08:10 UTC
now i am learning about built in dialogue box
may be..
Egoscio
@Egoscio
Aug 27 2016 08:10 UTC
bruh you need to put down that code coffee, it's getting too deep in hed
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 08:12 UTC
@wearenotgroot thx.
CamperBot
@camperbot
Aug 27 2016 08:12 UTC
sohan2infosec sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1472 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
jamesmillerho
@jamesmillerho
Aug 27 2016 08:13 UTC
can someone tell me why it doesn't work
haven't done jQuery for a long,long time :sweat_smile:
greg
@wearenotgroot
Aug 27 2016 08:14 UTC
@jamesmillerho add jquery on the js settings?
jamesmillerho
@jamesmillerho
Aug 27 2016 08:14 UTC
lol
@wearenotgroot thanks
CamperBot
@camperbot
Aug 27 2016 08:14 UTC
jamesmillerho sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1473 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Egoscio
@Egoscio
Aug 27 2016 08:15 UTC
I wouldn't have thought of that in a million years :+1:
Darth Skywalker
@adityaparab
Aug 27 2016 08:17 UTC
@jamesmillerho : You didn't have jQuery included
also, what are you trying to achieve exactly?
jamesmillerho
@jamesmillerho
Aug 27 2016 08:17 UTC
I'm trying to do this: https://www.canva.com/
@adityaparab I made wordpress login button yesterday
Darth Skywalker
@adityaparab
Aug 27 2016 08:22 UTC
Sweet!
@jamesmillerho
Darth Skywalker
@adityaparab
Aug 27 2016 08:23 UTC
Nice!
@jamesmillerho : I've made a few changes to your button. Take a look.
jamesmillerho
@jamesmillerho
Aug 27 2016 08:28 UTC
@adityaparab I just added cursor: pointer
Darth Skywalker
@adityaparab
Aug 27 2016 08:28 UTC
one thing I did is that I contextualized your styles. and removed the button positioning from the button.
This way, you can give this css to anyone and they can just plug and play
It's a good practice while developing frameworks/library that you delegate the positioning responsibility to the users/consumers :D
jamesmillerho
@jamesmillerho
Aug 27 2016 08:31 UTC
@adityaparab great. thanks
CamperBot
@camperbot
Aug 27 2016 08:31 UTC
jamesmillerho sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 633 | @adityaparab |http://www.freecodecamp.com/adityaparab
Raj
@RajKumar1605
Aug 27 2016 08:47 UTC
What is wrong with my 2d Collision Detection function that uses Separating Axis Theorem ?
function collisionCheck() {
    /* getting all the axes from both shapes */
    var axes = [];
    for(var i=0; i<shape1.vertices.length; i++) {
        var v1 = shape1.vertices[i];
        var v2 = [];
        if(i < shape1.vertices.length-1) {
            v2 = shape1.vertices[i+1];
        }
        else {
            v2 = shape1.vertices[0];
        }
        var edge = [v2[0]-v1[0], v2[1]-v1[1]];
        var normal = [-edge[1], edge[0]];
        var mag = Math.sqrt(normal[0]*normal[0] + normal[1]*normal[1]);
        var unit = [normal[0]/mag, normal[1]/mag];
        axes.push(unit);
    }
    for(var i=0; i<shape2.vertices.length; i++) {
        var v1 = shape2.vertices[i];
        var v2 = [];
        if(i < shape2.vertices.length-1) {
            v2 = shape2.vertices[i+1];
        }
        else {
            v2 = shape2.vertices[0];
        }
        var edge = [v2[0]-v1[0], v2[1]-v1[1]];
        var normal = [-edge[1], edge[0]];
        var mag = Math.sqrt(normal[0]*normal[0] + normal[1]*normal[1]);
        var unit = [normal[0]/mag, normal[1]/mag];
        axes.push(unit);
    }
    /* projecting both shapes onto each axes */
    for(var i=0; i<axes.length; i++) {
        var axis = axes[i];
        // projecting shape 1
        var min = Infinity;
        var max = -Infinity;
        for(var j=0; j<shape1.vertices.length; j++) {
            var vertex = shape1.vertices[j];
            var proj = axis[0]*vertex[0] + axis[1]*vertex[1];
            if(proj < min) {
                min = proj;
            }
            else if(proj > max) {
                max = proj;
            }
        }
        var projection1 = [min, max];
        // projecting shape 2
        var min = Infinity;
        var max = -Infinity;
        for(var j=0; j<shape2.vertices.length; j++) {
            var vertex = shape2.vertices[j];
            var proj = axis[0]*vertex[0] + axis[1]*vertex[1];
            if(proj < min) {
                min = proj;
            }
            else if(proj > max) {
                max = proj;
            }
        }
        var projection2 = [min, max];
        if(projection1[1] > projection2[0] && projection1[0] < projection2[0]) {

        }
        else if(projection2[1] > projection1[0] && projection2[0] < projection1[0]) {

        }
        else { 
            return false; // return false if projections not overlapping on any one axis
        }
    }
    return true; // return true if projections is overlapping on all the axes
};
Egoscio
@Egoscio
Aug 27 2016 08:48 UTC
That's not legible, please beautify it and format using triple back ticks
'''
CamperBot
@camperbot
Aug 27 2016 08:48 UTC
:bulb: to format code use backticks! ``` more info
Egoscio
@Egoscio
Aug 27 2016 08:49 UTC
Or use gist.github.com or hastebin.com
Milos Gemaljevic
@havocZz
Aug 27 2016 09:08 UTC
hello ppls, im stuck on JS Convert to Fahrenheit challange, I dont get it what should I do
Ademola Adegbuyi
@ooade
Aug 27 2016 09:08 UTC
Show ur code @havocZz
Milos Gemaljevic
@havocZz
Aug 27 2016 09:09 UTC

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

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

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

jamesmillerho
@jamesmillerho
Aug 27 2016 09:09 UTC
I find it actually very difficult to do :https://www.canva.com/
Milos Gemaljevic
@havocZz
Aug 27 2016 09:09 UTC
that is default code, i didnt change anything
Ademola Adegbuyi
@ooade
Aug 27 2016 09:10 UTC
@havocZz OKay! Do you know the celcius to farenheit formula??
jamesmillerho
@jamesmillerho
Aug 27 2016 09:10 UTC
it un-blur where the mouse point to. But I can't specify that area with css or js
the background-image is a single entity.
Milos Gemaljevic
@havocZz
Aug 27 2016 09:11 UTC
@marhyorh its says here Celsius*(9/5)+32, if Im not mistaken
Ademola Adegbuyi
@ooade
Aug 27 2016 09:12 UTC
@havocZz Yeah! you're good to go. Pass it in your code... below // Only change code below this line
Remember case sensitivity
Raj
@RajKumar1605
Aug 27 2016 09:14 UTC
what about my code ?
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 09:22 UTC
I still didn’t get the Instruction.
Screen Shot 2016-08-27 at 16.21.44.png
Can anyone help me?
Milos Gemaljevic
@havocZz
Aug 27 2016 09:23 UTC
@marhyorh ty very much
CamperBot
@camperbot
Aug 27 2016 09:23 UTC
havoczz sends brownie points to @marhyorh :sparkles: :thumbsup: :sparkles:
:cookie: 709 | @marhyorh |http://www.freecodecamp.com/marhyorh
Ademola Adegbuyi
@ooade
Aug 27 2016 09:23 UTC
@havocZz :+1:
Egoscio
@Egoscio
Aug 27 2016 09:25 UTC
@Sohan2infoSec Can you tell us what you don't understand?
Ademola Adegbuyi
@ooade
Aug 27 2016 09:29 UTC
@Sohan2infoSec add the number, which is item to the end of the array arr. Start with that
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 09:29 UTC
Yeah, I added 6 and then I removed 1. @marhyorh
But I don’t know what to do next. @Egoscio
Ademola Adegbuyi
@ooade
Aug 27 2016 09:30 UTC
No, you shouldn't add 6... You should add item
@Sohan2infoSec And instead of returning item you should returned the removed item
Liew Xun
@damakuno
Aug 27 2016 09:33 UTC
@Sohan2infoSec
check /FreeCodeCamp chat
@Sohan2infoSec yeah, you need to return the value that is removed
Brendan Kinahan
@BKinahan
Aug 27 2016 09:40 UTC
morning campers o/
Ademola Adegbuyi
@ooade
Aug 27 2016 09:41 UTC
morning... @BKinahan
FreddySun
@sunpeng897570
Aug 27 2016 09:54 UTC
@BKinahan morning my friend
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:09 UTC
Can anyone give me some more hints?
Screen Shot 2016-08-27 at 16.21.44.png
@marhyorh I can’t figure it out :|.
Raj
@RajKumar1605
Aug 27 2016 10:10 UTC
This message was deleted
Markus Kiili
@Masd925
Aug 27 2016 10:15 UTC
@Sohan2infoSec There are two array methods that do those two things asked. Use them on arrand item.
Brendan Kinahan
@BKinahan
Aug 27 2016 10:16 UTC
@Masd925 howdy o/
Markus Kiili
@Masd925
Aug 27 2016 10:16 UTC
@BKinahan Yo!
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:16 UTC
@Masd925 U mean .push and .shift?
Markus Kiili
@Masd925
Aug 27 2016 10:17 UTC
@Sohan2infoSec Yes.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:17 UTC
"function should then return the element that was removed.” How can I return it?
@Masd925
Markus Kiili
@Masd925
Aug 27 2016 10:18 UTC
@Sohan2infoSec Check what is the return value of shift method.
Milos
@Milos2709
Aug 27 2016 10:21 UTC
Sum All Primes challenge - from Wikipedia:
In number theory, a formula for primes is a formula generating the prime numbers, exactly and without exception. No such formula which is efficiently computable is known. A number of constraints are known, showing what such a "formula" can and cannot be.
Really? :D
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:22 UTC
@Masd925 yeah, I just wonder how can I return that “removed” value?
Because, it is disappeared :|.
Walid Ashri
@walidashri
Aug 27 2016 10:23 UTC
hi all
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:23 UTC
@AshriSoft hi :D.
Markus Kiili
@Masd925
Aug 27 2016 10:23 UTC
@Milos2709 Yes, all algorithms are slow. However you can easily generate a simple brute force algorithm that passes the challenge.
Walid Ashri
@walidashri
Aug 27 2016 10:24 UTC

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var x = Object.keys(source);
for(i=0;i<collection.length;i++){
  for(j=0;j<x.length;j++){
    if(collection[i].hasOwnProperty(x[j])&& collection[i][x[j]] === source[x[j]]){
      arr.push(collection[i]);
    }
  }
}  

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

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
this works only if source has a single key what I'm missing Please
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:25 UTC
@Masd925 Haha, it sounds nice. But can u give me the real solution?
Markus Kiili
@Masd925
Aug 27 2016 10:25 UTC
@AshriSoft Only push if the property values match for all the source keys, not just for one key.
Walid Ashri
@walidashri
Aug 27 2016 10:26 UTC
@Masd925 yes I know how this can be done :(
Henry Cabello
@hacu9
Aug 27 2016 10:27 UTC
Im on the truncate a string challenge and this is my code
Anthony Drane
@Antiaccess
Aug 27 2016 10:27 UTC
Hey peeps, this is supposed to output FREE LOVE? (by moving the character selection 13 places), my output is DREE >OVE? which I don't get because the second if else tree works for the E's (R's in the input). Anyway, here's the code if anyone can give me a hint?
function rot13(str) {
  var rot13 = "";
  for (var i = 0; i < str.length; i++){
    if (90 >= str.charCodeAt(i) && str.charCodeAt(i) >= 65){
        if (str.charCodeAt(i) < 78){
            rot13 += String.fromCharCode(str.charCodeAt(i)+13);
        } else {
            var num = 90 - str.charCodeAt(i);
            rot13 += String.fromCharCode(61+num);
        }
    } else {
        rot13 += str[i];
    }
}
  return rot13;
}


// Change the inputs below to test
rot13("SERR YBIR?");
Henry Cabello
@hacu9
Aug 27 2016 10:27 UTC

}else if(str.length<=3) {

newstr = str.slice(0,num+3);
newstr +=("...");
   console.log(newstr,str.length,num);

return newstr;

}

Markus Kiili
@Masd925
Aug 27 2016 10:28 UTC
@Sohan2infoSec Just put the return keyword before the statement that uses .shift().
Henry Cabello
@hacu9
Aug 27 2016 10:28 UTC
instead of returning A... it returns ...
truncateString("Absolutely Longer", 2) should return "Ab..." it returns Absolutely Longe...
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:29 UTC
@Masd925 oh, I did not think about this. Thx you.
CamperBot
@camperbot
Aug 27 2016 10:29 UTC
sohan2infosec sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2372 | @masd925 |http://www.freecodecamp.com/masd925
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:29 UTC
@Masd925 I’m so bad :(.
Markus Kiili
@Masd925
Aug 27 2016 10:30 UTC
@Sohan2infoSec It just takes some time learn these things.
kwal0203
@kwal0203
Aug 27 2016 10:30 UTC
hey anybody in here know C?
Henry Cabello
@hacu9
Aug 27 2016 10:31 UTC
Anyone? D: it keeps silicing where i dont want it to xd
Milos
@Milos2709
Aug 27 2016 10:33 UTC
thanks @Masd925 I'll try something out
CamperBot
@camperbot
Aug 27 2016 10:33 UTC
milos2709 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2373 | @masd925 |http://www.freecodecamp.com/masd925
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:33 UTC
@Masd925 So it will Return the first value and then it removes the first number, right? Like doing from the outside to inside of the code.
Anthony Drane
@Antiaccess
Aug 27 2016 10:34 UTC
Can anyone help with the above? I kind of need a hint so I can be distracted by coding instead of thinking about this girl...
Markus Kiili
@Masd925
Aug 27 2016 10:35 UTC
@Sohan2infoSec return arr.shift(); mutates the array by removing the first element and the method returns it. Then return keyword returns that removed element from the function.
Henry Cabello
@hacu9
Aug 27 2016 10:37 UTC
 ``` var newstr;

if(str.length>num){

newstr = str.slice(0,num-3);
newstr+=("...");
  console.log(newstr,str.length);
return newstr;

}else if (num>=str.length){

return str;

}else if(str.length<=3) {
var num1= num;
newstr = str.slice(0,num1-3);
newstr +=("...");
console.log(num1,newstr,str.length);
return newstr;

} ```

Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:37 UTC
@Masd925 Yeah, but what is the relation of that with the topic “queue” of the lesson?
Henry Cabello
@hacu9
Aug 27 2016 10:37 UTC
it feels like the num var isnt reaching the bottom part
Markus Kiili
@Masd925
Aug 27 2016 10:37 UTC
@Sohan2infoSec A queue can be implemented with a JS array.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:38 UTC
Screen Shot 2016-08-27 at 17.38.24.png
What does this requirement mean?
Markus Kiili
@Masd925
Aug 27 2016 10:40 UTC
@Sohan2infoSec It tests whether the function does what it should.
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:40 UTC

Hi,I'm stuck on the Profile Lookup,as I don't understand the whats up with my if statement

function lookUpProfile(firstName, prop){
    for (var i = 0;i < contacts.length;++i) {
        if (contacts[i][firstName] == firstName && contacts[i][prop] == prop)
            return contacts[i][prop];
    }
}

I've already tried multiple tests but no matter what I can't seem to compare those two strings. I know that by using '===' both type and value have to be equal but with '==' this rule shouldn't apply

this is just a portion of the code
Markus Kiili
@Masd925
Aug 27 2016 10:41 UTC
@shxdow contacts[i][firstName] <- quotes needed on firstName here
@shxdow Property existence check should be made with .hasOwnProperty() or .propertyIsEnumerable()
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:42 UTC
@Masd925 .hasOwnProperty only allows me to check the existance,not the value
Markus Kiili
@Masd925
Aug 27 2016 10:42 UTC
@shxdow The simplest structure is two nested if's for the two checks.
@shxdow Yes, you access the value on if block. The test uses .hasOwnProperty()
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:44 UTC
@Masd925 oh,you're right. By using .hasOwnProperty iterating through the whole array is no longer necessary
balakrishna
@balabkk
Aug 27 2016 10:44 UTC

// Setup
var testString = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";

// Example
var expressionToGetSoftware = /software/gi;
var softwareCount = testString.match(expressionToGetSoftware).length;

// Only change code below this line.

var expression = /and./gi; // Change this Line

// Only change code above this line

// This code counts the matches of expression in testString
var andCount = testString.match(expression).length;

error....correct...pls
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:45 UTC
@Masd925 thank you
CamperBot
@camperbot
Aug 27 2016 10:45 UTC
shxdow sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2374 | @masd925 |http://www.freecodecamp.com/masd925
Anthony Drane
@Antiaccess
Aug 27 2016 10:46 UTC
Hey peeps, this is supposed to output FREE LOVE? (by moving the character selection 13 places), my output is DxRExEx >xOVEx? (the x's there to check which if/else chain it goes down - which I don't get because it works for the E's (R's in the input), but not the S or the Y. Anyway, here's the code if anyone can give me a hint?
function rot13(str) {
  var rot13 = "";
  console.log('ABZ'.charCodeAt(2));
  for (var i = 0; i < str.length; i++){
    if (90 >= str.charCodeAt(i) && str.charCodeAt(i) >= 65){
        if (str.charCodeAt(i) < 78){
            rot13 += String.fromCharCode(str.charCodeAt(i)+13);
        } else {
            var num = 90 - str.charCodeAt(i);
            rot13 += String.fromCharCode(61+num) + "x";
        }
    } else {
        rot13 += str[i];
    }
}
  return rot13;
}


// Change the inputs below to test
rot13("SERR YBIR?");
Karayel
@Karayel
Aug 27 2016 10:47 UTC
I have some issues about codepen. Can anybody help me ?
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:51 UTC
@Masd925 what's the point in checking whether the property exists or not,the problem only cares whether values do so or not.
Markus Kiili
@Masd925
Aug 27 2016 10:54 UTC
@shxdow The last requirement deals with contact not having property key stored in prop.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:56 UTC
@Masd925 but why I typed
arr.shift();
return arr.shift();
it results the same as
return arr.shift();
Are they really equal to each other?
Screen Shot 2016-08-27 at 17.56.35.png
Markus Kiili
@Masd925
Aug 27 2016 10:57 UTC
@Sohan2infoSec No, they are not equal.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:57 UTC
But they still let me pass the lesson?
Markus Kiili
@Masd925
Aug 27 2016 10:58 UTC
@Sohan2infoSec No it doesn't pass. Some problem with the page most probably.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:58 UTC
@Masd925 oh, it’s not. Just check again. Thank you.
CamperBot
@camperbot
Aug 27 2016 10:58 UTC
sohan2infosec sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: sohan2infosec already gave masd925 points
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:02 UTC
@Masd925 I read the online doc for .hasOwnProperty but I cant tell whether it works even with arrays containing objects or not. Do I have to iterate throught every element in the array in order to know whether the property is there or not
Markus Kiili
@Masd925
Aug 27 2016 11:05 UTC
@shxdow You iterate the contacts array and inside the loop block you have one contact contacts[i]. Then you should have two nested if's that test whether the contact is the one you seek (correct first name) and whether the contact has the property key stored in prop. Simple .hasOwnProperty() test on the object is enough.
Luis
@letorruella
Aug 27 2016 11:09 UTC
Hi. hows everybody?
Telianth
@Telianth
Aug 27 2016 11:14 UTC
@letorruella I got rushed by a swarm of mosquitoes, it wasn't pleasant :|
Liman Abba
@limanCode
Aug 27 2016 11:15 UTC
check for palindromes

this is my code function palindrome(str) {
// Good luck!

var liman = str.replace(/[^A-Za-z0-9]/g, '');

if (liman === liman.split('').reverse().join('')) {
return true;
}
else return false;

}

palindrome("eye");

Where am i wrong please
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:17 UTC
@shxdow contacts[i][firstName] <- quotes needed on firstName here
@Masd925 why are quotes needed
anurag
@anuragparmar
Aug 27 2016 11:18 UTC
need some help in this task Convert Celsius to Fahrenheit
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:18 UTC
@Masd925 I'm sorry to bother you again but I can't seem to get it right
for (var i = 0;i < contacts.length;++i) {
        if (contacts[i].hasOwnProperty(firstName) && contacts[i].hasOwnProperty(prop)) {
            if (contacts[i][firstName] == firstName && contacts[i][prop] == prop)
                return contacts[i][prop];
        }
    }
Markus Kiili
@Masd925
Aug 27 2016 11:19 UTC
@shxdow You need to get the value of property key "firstName". Nothing to do with the value of function parameterfirstName that would be used on the code your posted there contacts[i][firstName]
@shxdow The first if should only have the first name check, and the second the property existence check. Then only the returns on correct spots.
contacts[i]["firstName"] === firstName on the first and contacts[i].hasOwnProperty(prop) on the second if.
Nitesh
@nidsnitesh
Aug 27 2016 11:22 UTC
can any one expalin me golf code
please
anurag
@anuragparmar
Aug 27 2016 11:35 UTC
i m stuck at this challenge Convert Celsius to Fahrenheit
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:41 UTC
show the code
Nitesh
@nidsnitesh
Aug 27 2016 11:41 UTC
@alexanderkopke

function golfScore(par, strokes) {
// Only change code below this line

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

// Change these values to test
golfScore(5, 4);

condition
golfScore(4, 1) should return "Hole-in-one!"
golfScore(4, 2) should return "Eagle"
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:43 UTC
ah ok you're starting out. One moment I have to look at the challenge
Nitesh
@nidsnitesh
Aug 27 2016 11:43 UTC
?????
ok
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:46 UTC
@Masd925 oh I see. thank you for helping me. passed it.
CamperBot
@camperbot
Aug 27 2016 11:46 UTC
shxdow sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2375 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Aug 27 2016 11:48 UTC
@shxdow Good. Next do it with .reduce() method ;)
Nitesh
@nidsnitesh
Aug 27 2016 11:48 UTC
help meeeeeeeeeeeeeeeee
CamperBot
@camperbot
Aug 27 2016 11:48 UTC
no wiki entry for: meeeeeeeeeeeeeeeee
Nitesh
@nidsnitesh
Aug 27 2016 11:49 UTC
@alexanderkopke??
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:49 UTC
@nidsnitesh ok it seems you can make some if statements but you should also make a calculation to see which string to return
Linh Nguyen My
@pinglinh
Aug 27 2016 11:52 UTC
Hey guys I am trying out the escape sequences in strings but it’s not working var myStr = 'FirstLine\n SecondLine\\ ThirdLine\r’
var myStr = 'FirstLine\n SecondLine\\ ThirdLine\r
Not sure I am doing this correctly
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:56 UTC
@nidsnitesh the first could be something like: if (strokes === 1){ return "Hole-in-one!"}
Alexander Køpke
@alexanderkopke
Aug 27 2016 12:01 UTC
@pinglinh FirstLine newline backslash SecondLine backslash carriage-return ThirdLine <-- you have newline but after there should be a backslash. After SecondLine you put backslash, good, but then carriage-return is needed. You put the carriage returna after ThirdLine it should be before
Linh Nguyen My
@pinglinh
Aug 27 2016 12:03 UTC
@alexanderkopke ooooooooo lemme try
Alexander Køpke
@alexanderkopke
Aug 27 2016 12:04 UTC
FirstLine
\SecondLine\
ThirdLine
the output should look like that I think
Linh Nguyen My
@pinglinh
Aug 27 2016 12:04 UTC
var myStr = 'FirstLine\n \SecondLine\ \rThirdLine';
Stephen James
@sjames1958gm
Aug 27 2016 12:05 UTC
@pinglinh no spaces - and backslash is escpaed by a second backslash - see the table
Linh Nguyen My
@pinglinh
Aug 27 2016 12:05 UTC
var myStr = 'FirstLine\n \\SecondLine\\ \rThirdLine’;
nearly working
Stephen James
@sjames1958gm
Aug 27 2016 12:05 UTC
@pinglinh no spaces
Linh Nguyen My
@pinglinh
Aug 27 2016 12:05 UTC
@sjames1958gm okay lemme try
@sjames1958gm OMG thank you!!!!!!!!!!!!
CamperBot
@camperbot
Aug 27 2016 12:05 UTC
pinglinh sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2886 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Linh Nguyen My
@pinglinh
Aug 27 2016 12:06 UTC
@alexanderkopke @sjames1958gm thanks for your help guys :D
CamperBot
@camperbot
Aug 27 2016 12:06 UTC
pinglinh sends brownie points to @alexanderkopke and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: pinglinh already gave sjames1958gm points
:cookie: 726 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Stephen James
@sjames1958gm
Aug 27 2016 12:06 UTC
@pinglinh :+1:
BlueExe
@BlueExe
Aug 27 2016 12:11 UTC

Help me with Word Blanks pls

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

result = myNoun + myAdjective + myVerb + myAdverb;
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

CamperBot
@camperbot
Aug 27 2016 12:11 UTC
no wiki entry for: me with word blanks plsfunction wordblanksmynoun myadjective myverb myadverb var result your code below this line result mynoun myadjective myverb myadverb your code above this line return result change the words here to test your functionwordblankscat little hit slowly
Kevin
@txsrangers
Aug 27 2016 12:12 UTC
I'm on the Convert Celsius to Fahrenheit, and am unable to pass it for some unknown reason. I tried fahrenheit = (celsius *9/5) + 32. Why is this wrong?
BlueExe
@BlueExe
Aug 27 2016 12:12 UTC
@txsrangers fahrenheit = celsius *9 / 5 + 32;
Linh Nguyen My
@pinglinh
Aug 27 2016 12:12 UTC
@txsrangers should be fahrenheit = celsius * 9/5 + 32;
@txsrangers coz you are multiplying celsius by 9/5 and adding 32 to get the conversion in fahrenheit
Kevin
@txsrangers
Aug 27 2016 12:14 UTC
Hmm...the question doesn't read that way, but I'll try that.
BlueExe
@BlueExe
Aug 27 2016 12:14 UTC
@pinglinh The order of the factors does not alter the product
Kevin
@txsrangers
Aug 27 2016 12:15 UTC
true, but I wouldn't think the parenthesis would cause a problem.
BlueExe
@BlueExe
Aug 27 2016 12:15 UTC
fahrenheit = celsius * 9/5 + 32; i have it like this
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = myNoun + myAdjective + myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");
Whats wrong with this
(not the first line)
Kevin
@txsrangers
Aug 27 2016 12:15 UTC
Actually, the parenthesis were fine. I was spelling fahrenheit wrong. lol.
thanks for the help
Linh Nguyen My
@pinglinh
Aug 27 2016 12:16 UTC
@BlueExe yeah I was just following the order at which the question was worded
BlueExe
@BlueExe
Aug 27 2016 12:17 UTC

wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).

wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).

error on that 2
Markus Kiili
@Masd925
Aug 27 2016 12:17 UTC
@BlueExe Your output "catlittlehitslowly" from the function is not a sensible sentence.
You need some spaces and filler words and perhaps a full stop at the end.
BlueExe
@BlueExe
Aug 27 2016 12:18 UTC

I tried with

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = myNoun + myAdjective + myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("cat,", " little,", " hit,", " slowly.");

but doesnt work

Markus Kiili
@Masd925
Aug 27 2016 12:19 UTC
@BlueExe Don't add spaces to the test function call.
BlueExe
@BlueExe
Aug 27 2016 12:19 UTC
HOW?
Markus Kiili
@Masd925
Aug 27 2016 12:19 UTC
Alter the function code only.
@BlueExe "A large "+myNoun+" ate my dinner." In that fassion.
BlueExe
@BlueExe
Aug 27 2016 12:21 UTC
I dont understand
Markus Kiili
@Masd925
Aug 27 2016 12:22 UTC
@BlueExe A function call passes some words that are stored on those function parameters myNoun etc. You use the parameters to make a big sentence (string).
Then whatever words are passed, the return from the function is a sensible sentence.
BlueExe
@BlueExe
Aug 27 2016 12:25 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

result = "A "+myAdjective+" "+myNoun+" ate my dinner "+myAdverb+", and then I "+myVerb+"the table.";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

Still not worgking
Sorry i missed a space
kristerChawa
@kristerChawa
Aug 27 2016 12:30 UTC
Hi
I am kinda stuck with local scope and functions. I think there's a bug here
Markus Kiili
@Masd925
Aug 27 2016 12:32 UTC
@kristerChawa I believe there are no bugs there. The description used to be somewhat confusing though.
kristerChawa
@kristerChawa
Aug 27 2016 12:34 UTC
It says that I should remove the console.log. I've removed it and declared a global variable already but still not working
Markus Kiili
@Masd925
Aug 27 2016 12:35 UTC
@kristerChawa Try removing both the console.logs.
kristerChawa
@kristerChawa
Aug 27 2016 12:36 UTC
I've already tried it but still not working.
Markus Kiili
@Masd925
Aug 27 2016 12:36 UTC
@kristerChawa Post your code here.
kristerChawa
@kristerChawa
Aug 27 2016 12:37 UTC
blob
Markus Kiili
@Masd925
Aug 27 2016 12:39 UTC
@kristerChawa Don't touch the 'use strict'; at the start of function. It should be there on its own line.
Stephen James
@sjames1958gm
Aug 27 2016 12:40 UTC
@kristerChawa It says do not create a global myVar which you have
Joseph
@revisualize
Aug 27 2016 12:40 UTC
Good morning.
Stephen James
@sjames1958gm
Aug 27 2016 12:41 UTC
@revisualize Hey early out there in WA
Joseph
@revisualize
Aug 27 2016 12:41 UTC
@kristerChawa There is no bug. You have a global variable.
kristerChawa
@kristerChawa
Aug 27 2016 12:41 UTC
@sjames1958gm I didn't create a global myVar at first and it's still not working .
Joseph
@revisualize
Aug 27 2016 12:41 UTC
@kristerChawa Line 8.
Remove line 8
jcfa01
@jcfa01
Aug 27 2016 12:43 UTC
hey guys i just want to know how to call the parameters after the array in seek and destroy challenge, anyone? thanks :D
Joseph
@revisualize
Aug 27 2016 12:43 UTC
// global stuff

function name(name) {
    return name;      // Stuff in the local scope to the function.
}

// More of that global stuff.
@jcfa01 arguments object.
Stephen James
@sjames1958gm
Aug 27 2016 12:43 UTC
@jcfa01 Read the arguments object link -
jcfa01
@jcfa01
Aug 27 2016 12:44 UTC
okay thanks
Joseph
@revisualize
Aug 27 2016 12:46 UTC
@jcfa01 You do realize that those links are there to help you?
jcfa01
@jcfa01
Aug 27 2016 12:48 UTC
@revisualize i check filter, i thought i knew arguments, guess not haha
Stephen James
@sjames1958gm
Aug 27 2016 12:49 UTC
@jcfa01 arguments is going to be a new and important concept - used in later challenges.
Dany Din
@danydin
Aug 27 2016 12:55 UTC
@sjames1958gm hey
Stephen James
@sjames1958gm
Aug 27 2016 12:55 UTC
@danydin hello
Dany Din
@danydin
Aug 27 2016 12:55 UTC
one question abotu git
if i make a commit to one file it saves all the files or just this specific one?
Stephen James
@sjames1958gm
Aug 27 2016 12:56 UTC
if you include the file name on the commit then only that one. if you don't it will commit all
kelearning
@kelearning
Aug 27 2016 12:57 UTC
maximum call stack size exceeded怎么分析解决
Dany Din
@danydin
Aug 27 2016 12:57 UTC
ok thanks @sjames1958gm
CamperBot
@camperbot
Aug 27 2016 12:57 UTC
danydin sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2887 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Dany Din
@danydin
Aug 27 2016 12:57 UTC
@kelearning that means you've infinite loop there
check your loop func
Stephen James
@sjames1958gm
Aug 27 2016 12:58 UTC
@kelearning Are you doing recursion?
mikelafalce
@mikelafalce
Aug 27 2016 13:02 UTC
Good morning all! Anyone available help me with a dumb question?
Stephen James
@sjames1958gm
Aug 27 2016 13:03 UTC
@mikelafalce Sure -
PrivateRoom5
@PrivateRoom5
Aug 27 2016 13:08 UTC
Hi! Could anyone tell me how I can post a picture of what I'm coding, just like a user did a little bit above please?Thanks
jamesmillerho
@jamesmillerho
Aug 27 2016 13:09 UTC
blob
why the line doesn't goes to the opposite corner
Markus Kiili
@Masd925
Aug 27 2016 13:11 UTC
explain format
CamperBot
@camperbot
Aug 27 2016 13:11 UTC
no wiki entry for: format
Joseph
@revisualize
Aug 27 2016 13:12 UTC
```js [SHIFT+ENTER]
// your code here
```[CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output
var code = undefined;
hashtag-i.am.not.a.campbot.replacement
Hèlen Grives
@mesmoiron
Aug 27 2016 13:15 UTC
Hi, is it possible to make an array from a calculation and push that array into another array. I think I already finding the answer
Brendan Kinahan
@BKinahan
Aug 27 2016 13:15 UTC
that's not how hashtags work. that's not how any of this works.
Markus Kiili
@Masd925
Aug 27 2016 13:16 UTC
@mesmoiron Yes, array elements can be any values (primitives or objects like arrays).
Or even a reference to the array itself. I dare not call that array by its name.
Brendan Kinahan
@BKinahan
Aug 27 2016 13:18 UTC
OUROBOROS
Hèlen Grives
@mesmoiron
Aug 27 2016 13:20 UTC
@Masd925 ok thank you :-)
CamperBot
@camperbot
Aug 27 2016 13:20 UTC
mesmoiron sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2377 | @masd925 |http://www.freecodecamp.com/masd925
Austin Melms
@melmsie
Aug 27 2016 13:22 UTC
help
David Beczuk
@dbeczuk
Aug 27 2016 13:23 UTC
Can someone please explain which practice is better and why? var myArray = Array.prototype.slice.call(arguments,1) or var myArray = array.slice.call(arguments,1)
Brendan Kinahan
@BKinahan
Aug 27 2016 13:23 UTC
This message was deleted
Markus Kiili
@Masd925
Aug 27 2016 13:24 UTC
@BKinahan There is serious scientific study on the subject of whether our universe is a computer simulation. One possible way to find out is to make heavy calculations that would crash the simulation running our universe. Just creating those kinds of objects you mentioned there could eat away our world. Hmm...maybe a black hole is really an OUROBOROS?
David Beczuk
@dbeczuk
Aug 27 2016 13:24 UTC
@BKinahan but is it better to extract dirrectly or use a prototype to build the new array?
Brendan Kinahan
@BKinahan
Aug 27 2016 13:24 UTC
@Masd925 I would argue that you couldn't make any conclusions based on that, since a simulation crash would break causality
@dbeczuk you're not really using a prototype, you're just accessing the slice() method which is a property of the Array prototype
Markus Kiili
@Masd925
Aug 27 2016 13:26 UTC
@BKinahan Yes, it would not be "finding out" if we suddenly ceased to exist.
David Beczuk
@dbeczuk
Aug 27 2016 13:27 UTC
@Masd925 I just want to understand why would I use one and not the later one wich extracts the slice dirrectly from the array provided?
@Masd925 is the Array.prototype.slice faster than array.slice?
Markus Kiili
@Masd925
Aug 27 2016 13:29 UTC
@dbeczuk [].slice() is shorter to write than Array.prototype.slice(). No difference otherwise.
David Beczuk
@dbeczuk
Aug 27 2016 13:29 UTC
@Masd925 so is no drawback otherwise.
Stephen James
@sjames1958gm
Aug 27 2016 13:29 UTC
@jamesmillerho Put the width/height in the canvas object, not css -
http://www.ckollars.org/canvas-two-coordinate-scales.html
David Beczuk
@dbeczuk
Aug 27 2016 13:29 UTC
they do the same thing.
PrivateRoom5
@PrivateRoom5
Aug 27 2016 13:30 UTC
function lookUpProfile(firstName, prop){
// Only change code below this line
  for(i=0; i<contacts.length;i++){
    for( var key in contacts[i]){
      if (firstName == contacts[i].firstName && contacts[i].hasOwnProperty(prop)){
        return contacts[i].firstName;
        return contacts[i].prop;

      }
    }
  }
// Only change code above this line
}
Stephen James
@sjames1958gm
Aug 27 2016 13:31 UTC
@PrivateRoom5 The for .. in loop is not needed - as you are not using key. You cannot have two returns, use brackets with prop
PrivateRoom5
@PrivateRoom5
Aug 27 2016 13:31 UTC
Hi anyone can help me please. It says unreachable return after return
Stephen James
@sjames1958gm
Aug 27 2016 13:32 UTC
@PrivateRoom5 Remove the first return and fix the second - you are only suppose to return the prop (as you are given the firstname)
PrivateRoom5
@PrivateRoom5
Aug 27 2016 13:32 UTC
so I can have as many console.log() as I want but just one return
jamesmillerho
@jamesmillerho
Aug 27 2016 13:32 UTC
@sjames1958gm nope I found that canvas ratio is fixed width = height *2 so if you change that ratio the content ratio will change to but thanks anyway
CamperBot
@camperbot
Aug 27 2016 13:32 UTC
jamesmillerho sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2888 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
David Beczuk
@dbeczuk
Aug 27 2016 13:32 UTC
@Masd925 thanks :)
CamperBot
@camperbot
Aug 27 2016 13:32 UTC
dbeczuk sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2378 | @masd925 |http://www.freecodecamp.com/masd925
Stephen James
@sjames1958gm
Aug 27 2016 13:32 UTC
@jamesmillerho <canvas id="one" height="200" width="200"></canvas> this worked
Brendan Kinahan
@BKinahan
Aug 27 2016 13:33 UTC
^proper way to do it
"When no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high."
jamesmillerho
@jamesmillerho
Aug 27 2016 13:33 UTC
lol
magic
thanks @sjames1958gm @BKinahan
CamperBot
@camperbot
Aug 27 2016 13:33 UTC
jamesmillerho sends brownie points to @sjames1958gm and @bkinahan :sparkles: :thumbsup: :sparkles:
:warning: jamesmillerho already gave sjames1958gm points
:star2: 2316 | @bkinahan |http://www.freecodecamp.com/bkinahan
Brendan Kinahan
@BKinahan
Aug 27 2016 13:34 UTC
"The element can be sized arbitrarily by CSS, but during rendering the image is scaled to fit its layout size: if the CSS sizing doesn't respect the ratio of the initial canvas, it will appear distorted." https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_usage
Stephen James
@sjames1958gm
Aug 27 2016 13:34 UTC
@jamesmillerho Thanks to you - learned something new :)
CamperBot
@camperbot
Aug 27 2016 13:34 UTC
sjames1958gm sends brownie points to @jamesmillerho :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @jamesmillerho |http://www.freecodecamp.com/jamesmillerho
Kevin
@txsrangers
Aug 27 2016 13:34 UTC
@kristerChawa if you didn't get your question answered about the console issue, I had the same problem, and if you refresh your browser and don't assign myVar to 'strict', it will pass. https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Refresh-Your-Browser-Cache
Stephen James
@sjames1958gm
Aug 27 2016 13:36 UTC
@PrivateRoom5 Return leaves the function directly, so you cannot have a return followed by a return
Multiple returns in a function are allowed/used but need to be in different paths in the code (such as if () { return; } else { return; })
PrivateRoom5
@PrivateRoom5
Aug 27 2016 13:39 UTC
@sjames1958gm thx for your help and time. Still I haven't passed the lesson.I'll keep trying
CamperBot
@camperbot
Aug 27 2016 13:39 UTC
privateroom5 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2889 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Donatas
@Lieutenant4
Aug 27 2016 13:41 UTC
```
function updateRecords(id, prop, value) {
  if (prop === "tracks" && value !==""){
    if (collection[id][prop]){
      (collection[id][prop].push(value));
    }  else{
      collection[id][prop] = [value];
    }  else if (value !==""){
      collection[id][prop] = [value];

    }else{
      delete collection[id][prop];
    }
  }


  return collection;
}
sup lads. can someone heck what's wrong with this?
check*
David Beczuk
@dbeczuk
Aug 27 2016 13:42 UTC
@BKinahan After some further reading some claim that Array.prototype.slice() is faster than [].slice() because [] is an instence of Array.
but I am not sure if that affects the performance on small collections of data.
and it might be relevant on large amounts of data
@Lieutenant4 [value];
Donatas
@Lieutenant4
Aug 27 2016 13:46 UTC
which one?
David Beczuk
@dbeczuk
Aug 27 2016 13:46 UTC
should be value , lose the []
and you have an else if after else.
Ken Haduch
@khaduch
Aug 27 2016 13:47 UTC
@Lieutenant4 - one thing that you can do is to group all of the actions when the value !== '' within one if block:
if ( value !== '' ) {
    // do the things here if the value is not blank
} else {
    // do the things here if the value is blank
}
David Beczuk
@dbeczuk
Aug 27 2016 13:48 UTC
else if never goes after an else. Else is the last action in an if else loop. and you have else .... else if .... else
Donatas
@Lieutenant4
Aug 27 2016 13:48 UTC
okey got it, thanks both of you
FreddySun
@sunpeng897570
Aug 27 2016 13:50 UTC

Dear all,
I am working at Profile Lookup task
my code as below,it's dosen't work,any can help me?

function lookUpProfile(firstName, prop){
// Only change code below this line
var _type;
for(var i=0;i<contacts.length;i++){
if(contacts[i].firstName!=firstName)
{_type="No such contact";}
else{
switch(prop){
case "lastName":_type=contacts[i].lastName;
break;
case "number":_type=contacts[i].number;
break;
case "likes":_type=contacts[i].likes;
break;
default: _type="No such property";

    }

  }       
}
    return _type;
David Beczuk
@dbeczuk
Aug 27 2016 13:59 UTC
This message was deleted
FreddySun
@sunpeng897570
Aug 27 2016 14:01 UTC
pls..help
jamesmillerho
@jamesmillerho
Aug 27 2016 14:01 UTC
@sunpeng897570 how can I help you?
FreddySun
@sunpeng897570
Aug 27 2016 14:03 UTC

function lookUpProfile(firstName, prop){
// Only change code below this line
var _type;
for(var i=0;i<contacts.length;i++){
if(contacts[i].firstName!=firstName)
{_type="No such contact";}
else{
switch(prop){
case "lastName":_type=contacts[i].lastName;
break;
case "number":_type=contacts[i].number;
break;
case "likes":_type=contacts[i].likes;
break;
default: _type="No such property";

    }

  }       
}
    return _type;

// Only change code above this line
}

jamesmillerho
@jamesmillerho
Aug 27 2016 14:04 UTC
..
...
FreddySun
@sunpeng897570
Aug 27 2016 14:04 UTC
@jamesmillerho I don't why it's doesn't work
Profile Lookup
jamesmillerho
@jamesmillerho
Aug 27 2016 14:05 UTC
@sunpeng897570 I suggest you write what you want the function to do in English first
@sunpeng897570 or Chinese
@sunpeng897570 then "translate" that to Javascript
Norvin Burrus
@ndburrus
Aug 27 2016 14:10 UTC
@sunpeng897570 this may be useful: :sparkles:
FreddySun
@sunpeng897570
Aug 27 2016 14:12 UTC
ok, let my try, thx!
Moisés Man
@moigithub
Aug 27 2016 14:24 UTC
@sunpeng897570 check this..
var a;
a=1;
a = 2;
a = 3;
which will be the value of a ??? 1, 2 or 3 ??
ashish singh
@ashish1729
Aug 27 2016 14:25 UTC
a = 3 at last .. why ?
Ademola Adegbuyi
@ooade
Aug 27 2016 14:26 UTC
@Sohan2infoSec sorry, i was off
Moisés Man
@moigithub
Aug 27 2016 14:27 UTC
@ashish1729 yea.. question was for @sunpeng897570 thats why on the message have mentioned his name.. cuz his code above didnt work..
soo giving him another example WHY doesnt work....
FreddySun
@sunpeng897570
Aug 27 2016 14:28 UTC
a=3
ashish singh
@ashish1729
Aug 27 2016 14:28 UTC
ok sorry @moigithub
Moisés Man
@moigithub
Aug 27 2016 14:28 UTC
:+1: @ashish1729
Shivan Nawal
@Shivan11
Aug 27 2016 14:30 UTC
Hey guys, I'm Shivan, from India !
ashish singh
@ashish1729
Aug 27 2016 14:31 UTC
hey @shivan11 .. whats up
Stephen James
@sjames1958gm
Aug 27 2016 14:31 UTC
@Shivan11 Welcome
Moisés Man
@moigithub
Aug 27 2016 14:31 UTC
@sunpeng897570 soo if u check ur loop..
it will ITERATE on all the contacts objects..
and compare each of those names.. vs the firstName u pass
soo IF the first contact match the name.. ur variable _type will be whatever contact property it have...
but on the NEXT check.. contact will NOT match.. soo it overwrite _type value
... ur code on each iteration will CHANGE _type value
jamesmillerho
@jamesmillerho
Aug 27 2016 14:33 UTC
how to draw this triangle with javascript
3 angles are 96 , 42, 42
FreddySun
@sunpeng897570
Aug 27 2016 14:34 UTC
@moigithub got it!thank you!
Tyler Langan
@TylerL-uxai
Aug 27 2016 14:35 UTC

// Example
var firstName = "Tyler";
var lastName = "Langan";

// Only change code below this line
does anyone know why this challenge isn't working?
Moisés Man
@moigithub
Aug 27 2016 14:36 UTC
@TylerL-uxai that 2 lines looks correct
but.. depends what the exercise is asking u
Tyler Langan
@TylerL-uxai
Aug 27 2016 14:36 UTC
thank you @moigithub
CamperBot
@camperbot
Aug 27 2016 14:36 UTC
tylerl-uxai sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2017 | @moigithub |http://www.freecodecamp.com/moigithub
Tyler Langan
@TylerL-uxai
Aug 27 2016 14:36 UTC
thank you @moigithub
CamperBot
@camperbot
Aug 27 2016 14:36 UTC
tylerl-uxai sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:warning: tylerl-uxai already gave moigithub points
Tyler Langan
@TylerL-uxai
Aug 27 2016 14:36 UTC
So why doesn't it pass the challenge Declare String Variables?
Moisés Man
@moigithub
Aug 27 2016 14:37 UTC
thats ALL the code u have ???.. u suppose NOT change the code above.. and
ONLY write ur code BELOW that line
Tyler Langan
@TylerL-uxai
Aug 27 2016 14:37 UTC
oh, so let it be declared as Alan Turing and change it below?
oh I see
I need to make the variable name myFirstName instead of first name
thank you :)
Ken Haduch
@khaduch
Aug 27 2016 14:38 UTC
@TylerL-uxai - yes, the text that is already there is still expected to be there, the spelling (capitalization, etc., as they specify) is important. The testing code is looking for very specific things, and even though it might look correct to you, the testing code cannot be fooled... :) Use the testing results to help you, also - it tells you want it is looking for!
Shivan Nawal
@Shivan11
Aug 27 2016 14:45 UTC
Guys I'm new to JS and I wanted to start learning it. Should I start with the challenges directly or is there something I need to do first ?
ashish singh
@ashish1729
Aug 27 2016 14:45 UTC
@Shivan11 read from a book .. practice here ... // thats what i will suggest
Markus Kiili
@Masd925
Aug 27 2016 14:46 UTC
@Shivan11 I would advice to avoid W3Schools on the subject of javascript. Otherwise a good site.
ashish singh
@ashish1729
Aug 27 2016 14:47 UTC
@Masd925 ha ha .. its not good for deep understanding of anything ..
Yeyo Selso Poche
@Naxell
Aug 27 2016 14:47 UTC
@Masd925 so what do you advice.. then?
Norvin Burrus
@ndburrus
Aug 27 2016 14:49 UTC
@Shivan11
Welcome to fcc!!
Explore, enjoy, learn, and happy coding! :sparkles:
Markus Kiili
@Masd925
Aug 27 2016 14:50 UTC
@ashish1729 Yes, but usually their information is correct although limited. On JS the material has a lot of errors.
Alvin Kristanto
@alvinkl
Aug 27 2016 14:50 UTC
hi can someone help me with the algorithm challenge(return largest number in arrays), I have tried my best but I cant figure it out
ashish singh
@ashish1729
Aug 27 2016 14:50 UTC
@ndburrus .. cool resources. thanks for sharing
CamperBot
@camperbot
Aug 27 2016 14:50 UTC
:star2: 1911 | @ndburrus |http://www.freecodecamp.com/ndburrus
ashish1729 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
Norvin Burrus
@ndburrus
Aug 27 2016 14:50 UTC
@ashish1729 you're welcome! enjoy! :palm_tree:
ashish singh
@ashish1729
Aug 27 2016 14:50 UTC
@Masd925 oh ok ..
@alvinkl .. whats up ?
Eray Özer
@erayozer17
Aug 27 2016 14:51 UTC

hello everyone. i have a question for record collection challenge. can anyone tell me why doesn't this code work? 'function updateRecords(id, prop, value) {
if(prop !== "tracks" && value !== ""){
collection[id][prop] = value;
}
else if(prop === "tracks"){
if(!collection[id].hasOwnProperty(prop)){
collection[id].tracks = [];
}
collection[id].tracks.push(value);
}
else if(prop === "tracks" && value !== ""){
if(collection[id].hasOwnProperty(prop)){
collection[id].tracks.push(value);
}
}
else if(value === ""){

delete collection [id][prop];

}

return collection;
}
'

PrivateRoom5
@PrivateRoom5
Aug 27 2016 14:51 UTC
function lookUpProfile(firstName, prop){
// Only change code below this line
  for(i=0; i<contacts.length;i++){
      if (firstName == contacts[i].firstName && contacts[i].hasOwnProperty(prop)){
        return contacts[i][prop];
      }
  }
  for(i=0; i<contacts.length;i++){
    if(firstName !== contacts[i].firstName){
      return "No such contact";
    }
  }
  for(i=0;i<contacts.length;i++){
    if(contacts[i].hasOwnProperty(prop) === false){
      return "No such property";
    }
  }
// Only change code above this line
}
Yeyo Selso Poche
@Naxell
Aug 27 2016 14:51 UTC
@Masd925 so what kind of eerror do you find there?
Alvin Kristanto
@alvinkl
Aug 27 2016 14:52 UTC

function largestOfFour(arr) {
// You can do this!
var result = new Array();
var current = new Array();

for(var i = 0; i < arr.length; i++) {
for(var j = 0; j < arr[i].length; j++){
current[i] = sort(arr[i][j]);
}
result[i][j] = current[i];
}

return result;
}

function sort(arr) {
for(var i = 0; i < arr.length; i++) {
for(var j = 0; j < i; j++) {
if(arr[i] > arr[j]) {
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

PrivateRoom5
@PrivateRoom5
Aug 27 2016 14:52 UTC
The first two for loops work just fine but when i pass in a prop that does not exist it Does not return "No such property" any idea?
Alvin Kristanto
@alvinkl
Aug 27 2016 14:53 UTC
I couldn't get the largest number on each array
ashish singh
@ashish1729
Aug 27 2016 14:53 UTC
@alvin can you just name the challenge
Alvin Kristanto
@alvinkl
Aug 27 2016 14:54 UTC
Return Largest Numbers in Arrays
Vivienne Sales
@Natto278
Aug 27 2016 14:54 UTC
At today's local FCC meetup, one of the campers helped me solve items #4 and #5 of the Profile Lookup challenge. Thank you @sjames1958gm, @Masd925 @Athaman @wearenotgroot for helping me over the past two months. Special thanks to @jupiterpenny at today's FCC meeting. If I have forgotten anyone's name, please let me know so I can you brownie points, too!
CamperBot
@camperbot
Aug 27 2016 14:54 UTC
natto278 sends brownie points to @sjames1958gm and @masd925 and @athaman and @wearenotgroot and @jupiterpenny :sparkles: :thumbsup: :sparkles:
:star2: 2890 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 333 | @jupiterpenny |http://www.freecodecamp.com/jupiterpenny
:star2: 2379 | @masd925 |http://www.freecodecamp.com/masd925
:cookie: 622 | @athaman |http://www.freecodecamp.com/athaman
:star2: 1474 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Stephen James
@sjames1958gm
Aug 27 2016 14:55 UTC
@camperbot :+1:
Ken Haduch
@khaduch
Aug 27 2016 14:55 UTC
@PrivateRoom5 - you need to match the firstName in order to properly return the "No such property" status - your code does not properly do that check. In fact, you can eliminate the multiple for loops and put all of the testing and checking into the body of one for loop. (Keeping in mind that you have to be careful about the "No such contact" return...)
Antonin Archer
@nicknem
Aug 27 2016 14:56 UTC
Guys, I always get this issue when deploying my Node app, do you know what it is?
{ Error: ENOENT: no such file or directory, open '.env'
2016-08-27T14:55:25.237516+00:00 app[web.1]:     at Error (native)
2016-08-27T14:55:25.237517+00:00 app[web.1]:     at Object.fs.openSync (fs.js:634:18)
2016-08-27T14:55:25.237517+00:00 app[web.1]:     at Object.fs.readFileSync (fs.js:502:33)
2016-08-27T14:55:25.237518+00:00 app[web.1]:     at Object.module.exports.config (/app/node_modules/dotenv/lib/main.js:30:37)
2016-08-27T14:55:25.237519+00: