These are chat archives for FreeCodeCamp/HelpJavaScript

27th
Aug 2016
David Halls
@DavidHalls
Aug 27 2016 00:00
@crazymaster49 11 % 3 = 1 does not do anything
crazymaster49
@crazymaster49
Aug 27 2016 00:00
javascript
Moisés Man
@moigithub
Aug 27 2016 00:00
@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
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
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
a.k.a. modulo
crazymaster49
@crazymaster49
Aug 27 2016 00:03
Can you give me an example @moigithub in code of how this is used?
Joseph Parkton
@hippybear
Aug 27 2016 00:03
@Egoscio I think there is a difference
3 % 9 === 0
Vishon
@Symbolistic
Aug 27 2016 00:03
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
3 % 5 == 2
@Symbolistic not at all
Moisés Man
@moigithub
Aug 27 2016 00:04
re-read above.. the examples using differents operators.. @crazymaster49
Joseph Parkton
@hippybear
Aug 27 2016 00:04
@Symbolistic knowing how to google is the sign of a good programmer lol
crazymaster49
@crazymaster49
Aug 27 2016 00:04
Thank you all!
Vishon
@Symbolistic
Aug 27 2016 00:04
@hippybear cool, I was wondering cause it felt really easy after googling my problems, lol.
Joseph Parkton
@hippybear
Aug 27 2016 00:05
@crazymaster49 you can also do this in your devtools and see it in action
Moisés Man
@moigithub
Aug 27 2016 00:05
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
wait till you hit the ?
that thing had me baffled for a bit
crazymaster49
@crazymaster49
Aug 27 2016 00:06
hit the what ? @hippybear
Joseph Parkton
@hippybear
Aug 27 2016 00:06
ternary operator
?
Egoscio
@Egoscio
Aug 27 2016 00:06
Remainder uses a built in modulo function, weird.
crazymaster49
@crazymaster49
Aug 27 2016 00:06
@moigithub Thanks i am still working on figuring this out.
CamperBot
@camperbot
Aug 27 2016 00:06
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
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
nubs
Egoscio
@Egoscio
Aug 27 2016 00:08
I gotta think JS when I'm really a swifty :P
Joseph Parkton
@hippybear
Aug 27 2016 00:09
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
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
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
???
the import BS?
Joseph Parkton
@hippybear
Aug 27 2016 00:11
yeah
Egoscio
@Egoscio
Aug 27 2016 00:11
(I don't like import at all)
Joseph Parkton
@hippybear
Aug 27 2016 00:12
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
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
I thought not
Cage Echarte
@CageEcharte
Aug 27 2016 00:12
I need help with this exercise, Logical Order in If Else Statements
Egoscio
@Egoscio
Aug 27 2016 00:13
Post it over, we love helping
Joseph Parkton
@hippybear
Aug 27 2016 00:13
@CageEcharte show us the code
Egoscio
@Egoscio
Aug 27 2016 00:13
@hippybear How did a NPM dependency affect the ES6 module syntax?
Joseph Parkton
@hippybear
Aug 27 2016 00:14
Code bra
that shits srs biz
Egoscio
@Egoscio
Aug 27 2016 00:14
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

@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
@CageEcharte seems legit one sec
Moisés Man
@moigithub
Aug 27 2016 00:15
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
good catch
moigithub @moigithub wonder if @CageEcharte fell asleep :sleepy: :question:
Joseph Parkton
@hippybear
Aug 27 2016 00:20
lol
this chunk array in groups is killing me lol
Im gonna get it though
BrianR
@brianrudloff
Aug 27 2016 00:24
@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
Back
BrianR
@brianrudloff
Aug 27 2016 00:28
hi
Egoscio
@Egoscio
Aug 27 2016 00:28
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
hmm, cool. it's going to take me a while to absorb this
Egoscio
@Egoscio
Aug 27 2016 00:30
(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
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
Example:
```js
oops
Joseph Parkton
@hippybear
Aug 27 2016 00:31
why is that not an array?
Walid Ashri
@walidashri
Aug 27 2016 00:31
Hello World
CamperBot
@camperbot
Aug 27 2016 00:31

welcome to FreeCodeCamp @AshriSoft!

Egoscio
@Egoscio
Aug 27 2016 00:32
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
arr = [{some: 1},{some: 3},{some: 33}]
an array of objs
arrays are robust
Walid Ashri
@walidashri
Aug 27 2016 00:33
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
@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
anyone got some pointers for pairwise?
Joseph Parkton
@hippybear
Aug 27 2016 00:37
bam!
@Byzgig never heard of it
Moisés Man
@moigithub
Aug 27 2016 00:38
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
```
Joseph Parkton
@hippybear
Aug 27 2016 00:39
@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
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
im not on that one man
Moisés Man
@moigithub
Aug 27 2016 00:39
then ?
David Halls
@DavidHalls
Aug 27 2016 00:39
how do you post code again?
Egoscio
@Egoscio
Aug 27 2016 00:39
@hippybear Nope
Moisés Man
@moigithub
Aug 27 2016 00:39
copy paste
add backticks at start and end.. on its own line
Joseph Parkton
@hippybear
Aug 27 2016 00:40
@Egoscio splain
David Halls
@DavidHalls
Aug 27 2016 00:40
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
ahh that one :)
Egoscio
@Egoscio
Aug 27 2016 00:40
@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
function doStuff(a,arr){} doStuff(1, 44) will now have an array of ["44"]
Egoscio
@Egoscio
Aug 27 2016 00:41
@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
That array resembles an object
lol
youre amazing :)
Love the examples
Egoscio
@Egoscio
Aug 27 2016 00:42
;)
A node REPL is sometimes the best way to demonstrate stuff.
Joseph Parkton
@hippybear
Aug 27 2016 00:42
true that
I love the freenode rooms for the js repl
Egoscio
@Egoscio
Aug 27 2016 00:43
I have to go now, Mention if you need me and I'll check in later
Joseph Parkton
@hippybear
Aug 27 2016 00:43
it makes some things way easier
BrianR
@brianrudloff
Aug 27 2016 00:43
@Egoscio Thank you! I think i still have a lot to learn!
CamperBot
@camperbot
Aug 27 2016 00:43
brianrudloff sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:warning: brianrudloff already gave egoscio points
Egoscio
@Egoscio
Aug 27 2016 00:43
@brianrudloff Best of luck!
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:46
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
looks like you need nested loops
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:48
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
@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
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
@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
yeah
thats why i used one loop in the first place
Moisés Man
@moigithub
Aug 27 2016 00:52
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
@OmAgarwal2002 still can't see any reference to arr in your code
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:54
@AshriSoft what do u mean
David Halls
@DavidHalls
Aug 27 2016 00:54
@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
@OmAgarwal2002 what data type is j cuz j[i] is wrong
Om Agarwal
@om00webdeveloper
Aug 27 2016 00:54
@moigithub just an int
Walid Ashri
@walidashri
Aug 27 2016 00:55
@OmAgarwal2002 the second arg in apply is array I c j[i] which = nothing
Moisés Man
@moigithub
Aug 27 2016 00:55
@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
just use one loop and ref arr[i] instead of j[i] @OmAgarwal2002
Moisés Man
@moigithub
Aug 27 2016 00:57
@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
@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
Ray
@rbjr
Aug 27 2016 01:00
help missing letters
CamperBot
@camperbot
Aug 27 2016 01:00
no wiki entry for: missing letters
Moisés Man
@moigithub
Aug 27 2016 01:01
@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
@moigithub if val is 4 than what is "else if" ?
Moisés Man
@moigithub
Aug 27 2016 01:02
@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

@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
nvm :)
Cage Echarte
@CageEcharte
Aug 27 2016 01:04
@moigithub do I need to change the other "val" ??
Moisés Man
@moigithub
Aug 27 2016 01:04
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
@moigithub which val?
Moisés Man
@moigithub
Aug 27 2016 01:08
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
thanks buddy, havent gotten it yet but progressing, @moigithub
CamperBot
@camperbot
Aug 27 2016 01:09
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
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
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
@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
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
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
wow that sucks
and makes things a bit more confusing
Angel J Piscola
@Redmega
Aug 27 2016 01:25
@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
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
@Symbolistic Good job figuring it out :)
Vishon
@Symbolistic
Aug 27 2016 01:35
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

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
str[i] = str[i][0].toUpperCase()+str[i].slice(1); @Symbolistic
Angel J Piscola
@Redmega
Aug 27 2016 01:36
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
no wiki entry for: format
Cage Echarte
@CageEcharte
Aug 27 2016 01:37

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
``
```
Vishon
@Symbolistic
Aug 27 2016 01:37
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
Why is the bot not helping me with this
Moisés Man
@moigithub
Aug 27 2016 01:37
cuz all those were removed
Angel J Piscola
@Redmega
Aug 27 2016 01:37
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
probably they want user search on forum
all wiki moved to forum
Walid Ashri
@walidashri
Aug 27 2016 01:39
@johnngo 1 is less than 10 ur 2nd else if never in use
John Ngo
@johnngo
Aug 27 2016 01:41
I flipped the if and else if statements around and it worked
Cage Echarte
@CageEcharte
Aug 27 2016 01:42
@Redmega can you give a code example that is similar to mine
Walid Ashri
@walidashri
Aug 27 2016 01:42
@Redmega :clap:
@johnngo :clap:
Angel J Piscola
@Redmega
Aug 27 2016 01:42
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
return "Less than 10";
Angel J Piscola
@Redmega
Aug 27 2016 01:44
Talking to @CageEcharte , @AshriSoft . He's the one who needs help ;)
Cage Echarte
@CageEcharte
Aug 27 2016 01:45
@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
@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

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
mine is on ~ key :smile:
Angel J Piscola
@Redmega
Aug 27 2016 01:47
@purelight4ever backticks must be on their own lines
@AshriSoft shift+\`` = ~, generally speaking.
Essaid Serhani
@purelight4ever
Aug 27 2016 01:48
Do you mean on each line?
Angel J Piscola
@Redmega
Aug 27 2016 01:48
``` <----
Then your code
--- > ```
Like so
Cage Echarte
@CageEcharte
Aug 27 2016 01:49
@Redmega after i put the back ticks what do I do?
Essaid Serhani
@purelight4ever
Aug 27 2016 01:49
Oh ok thank you
Moisés Man
@moigithub
Aug 27 2016 01:49
@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
three backticks. hit shift+enter. paste your code. hit shift+enter. put three more backticks.
Cage Echarte
@CageEcharte
Aug 27 2016 01:50
@johnngo thank you , you are corect
CamperBot
@camperbot
Aug 27 2016 01:50
cageecharte sends brownie points to @johnngo :sparkles: :thumbsup: :sparkles:
:cookie: 179 | @johnngo |http://www.freecodecamp.com/johnngo
roninjedi
@roninjedi
Aug 27 2016 01:51
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
@roninjedi remove extra spaces
instruction says.. NO spaces
roninjedi
@roninjedi
Aug 27 2016 01:51
hmm ok i didn't think the spaces mattered
Cage Echarte
@CageEcharte
Aug 27 2016 01:52

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

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
Ah, I actually didn't know about compose mode
AmericanPi
@AmericanPi
Aug 27 2016 02:05
oooohhhhhhhhhhhhhhh!!!!!!!!!!!!!
Angel J Piscola
@Redmega
Aug 27 2016 02:05
I just shift+enter for line breaks
AmericanPi
@AmericanPi
Aug 27 2016 02:06
yea its in the bottom right crnewr of the text entry box
@Redmega
im out
Angel J Piscola
@Redmega
Aug 27 2016 02:06
Ciao
Tracey Bushman
@tbushman
Aug 27 2016 02:27
@Redmega (virtual beer)
Margaret
@Margaret2
Aug 27 2016 02:30
: beer : :beer:
Tracey Bushman
@tbushman
Aug 27 2016 02:31
:sweet:
Joseph
@revisualize
Aug 27 2016 02:32
Wow. This chat died.
Tracey Bushman
@tbushman
Aug 27 2016 02:33
Just in awe of @Redmega 's poise
Walid Ashri
@walidashri
Aug 27 2016 02:33
no it's on :beer: break :D
Margaret
@Margaret2
Aug 27 2016 02:34
@AshriSoft :laughing:
believeZJP
@believeZJP
Aug 27 2016 02:34
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
@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
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
can anyone create an attendance website
or attendance app
Egoscio
@Egoscio
Aug 27 2016 02:46
@Vipersad Elaborate?
Vipersad
@Vipersad
Aug 27 2016 02:47
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
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
can you please help me make it
friscodisco
@friscodisco
Aug 27 2016 02:49
I will do it for 25k
Egoscio
@Egoscio
Aug 27 2016 02:49
Do you have any programming knowledge?
lmao
Vipersad
@Vipersad
Aug 27 2016 02:49
a little bit
I just don't know how to start
please help
Alexander Køpke
@alexanderkopke
Aug 27 2016 02:52
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
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
they do that on their own phone or on a device at the place
friscodisco
@friscodisco
Aug 27 2016 02:55
I will make you site like this for 30k https://www.tracksmart.com
Vipersad
@Vipersad
Aug 27 2016 02:55
3000
friscodisco
@friscodisco
Aug 27 2016 02:56
30000 USD
Vipersad
@Vipersad
Aug 27 2016 02:57
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
Do you know node.js? (Ever heard of it?)
Vipersad
@Vipersad
Aug 27 2016 02:58
no
friscodisco
@friscodisco
Aug 27 2016 02:58
You should hire someone from fiverr.com they can make 3 social media websites for 5 USD
Egoscio
@Egoscio
Aug 27 2016 02:58
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
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
With node.js, you can do full stack development with a single language. http://nodejs.orh
*.org
Vipersad
@Vipersad
Aug 27 2016 03:00
ok
Egoscio
@Egoscio
Aug 27 2016 03:01
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
do you know where I can find a attendance template
Egoscio
@Egoscio
Aug 27 2016 03:01
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
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
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
:bulb: to format code use backticks! ``` more info
THalletProtech
@THalletProtech
Aug 27 2016 03:03
'''
CamperBot
@camperbot
Aug 27 2016 03:03
:bulb: to format code use backticks! ``` more info
THalletProtech
@THalletProtech
Aug 27 2016 03:03
whoops
Egoscio
@Egoscio
Aug 27 2016 03:03
(Not single quotes, back ticks)
E. Vazquez
@joufflu
Aug 27 2016 03:03
lol
Tracey Bushman
@tbushman
Aug 27 2016 03:04
@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
little CampberBot had a few too many this evening
@tbushman gotcha
@tbushman thank you
CamperBot
@camperbot
Aug 27 2016 03:04
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
that's a good cookie
Alexander Køpke
@alexanderkopke
Aug 27 2016 03:05
```
E. Vazquez
@joufflu
Aug 27 2016 03:06
```
joufflu @joufflu lol
THalletProtech
@THalletProtech
Aug 27 2016 03:09
shoot ill just do that
Abhijeet Phanse
@orionishere
Aug 27 2016 03:16
Hi guys... Can aanyone help me with switch statement?
Diego Mayer
@Chrono79
Aug 27 2016 03:17
@orionishere what's the problem?
Abhijeet Phanse
@orionishere
Aug 27 2016 03:20

@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
I don't see any switch's
Diego Mayer
@Chrono79
Aug 27 2016 03:21
@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
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
I went through it.... I have more doubts now.... @Chrono79
Diego Mayer
@Chrono79
Aug 27 2016 03:25
@THalletProtech that's wrong, you have to delete the property if value is empty string
Abhijeet Phanse
@orionishere
Aug 27 2016 03:25
I've changed the code according to structure....
Diego Mayer
@Chrono79
Aug 27 2016 03:26
let's see it
nicop
@nicopcat
Aug 27 2016 03:26

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
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
@Diego Mayer is that not what i am doing
nicop
@nicopcat
Aug 27 2016 03:27
dont know what does it want me to do
Diego Mayer
@Chrono79
Aug 27 2016 03:27
@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
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
@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
@orionishere do the change I told you, your function returns answer, set its value in each case
THalletProtech
@THalletProtech
Aug 27 2016 03:31
im not sure what you mean diego
Abhijeet Phanse
@orionishere
Aug 27 2016 03:34
thanks @Chrono79 .... i was able to do it.....
CamperBot
@camperbot
Aug 27 2016 03:34
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
@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
@ndburrus still dont know how to type T T
can u gimme an example
Diego Mayer
@Chrono79
Aug 27 2016 03:43
Essaid Serhani
@purelight4ever
Aug 27 2016 03:44
blob
coffeebeanzz
@coffeebeanzz
Aug 27 2016 03:45
@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
@purelight4ever separate card evaluation of count evaluation, return only in the last one
Essaid Serhani
@purelight4ever
Aug 27 2016 03:46
```
How can I do that please?
Diego Mayer
@Chrono79
Aug 27 2016 03:48
@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
@Chrono79 how i send you points?
Essaid Serhani
@purelight4ever
Aug 27 2016 03:50
@Chrono79 I will try that... Thank you
CamperBot
@camperbot
Aug 27 2016 03:50
purelight4ever sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1924 | @chrono79 |http://www.freecodecamp.com/chrono79
bibubi
@bibubi
Aug 27 2016 03:52
@purelight4ever
blob
Diego Mayer
@Chrono79
Aug 27 2016 03:54
THalletProtech just saying thanks and mentioning me
Essaid Serhani
@purelight4ever
Aug 27 2016 03:55
@bibubi Thank you so much... I wasted so much time trying to figure it out....!!!
CamperBot
@camperbot
Aug 27 2016 03:55
purelight4ever sends brownie points to @bibubi :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for bibubi
Diego Mayer
@Chrono79
Aug 27 2016 03:55
@bibubi that's a weird way of doing it but maybe it works ;)
Essaid Serhani
@purelight4ever
Aug 27 2016 03:56
@camperbot How can I do that? (I am new here!!)
bibubi
@bibubi
Aug 27 2016 03:57
:smile:
nicop
@nicopcat
Aug 27 2016 03:58
@coffeebeanzz @Chrono79 @ndburrus thank you so much :sparkles:
CamperBot
@camperbot
Aug 27 2016 03:58
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
you're welcome @nicopcat :)
Norvin Burrus
@ndburrus
Aug 27 2016 03:59
@nicopcat you're welcome! :palm_tree:
Diego Mayer
@Chrono79
Aug 27 2016 04:07
bye
Norvin Burrus
@ndburrus
Aug 27 2016 04:20
@purelight4ever :sparkles:
Mike
@SaxManMike
Aug 27 2016 04:39
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
Pairwise falls to @adventurebear!
Daniel Wu
@mejorna
Aug 27 2016 04:50

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
@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
@mejorna destroyer is a function,how coud you make it as a argument
Mike
@SaxManMike
Aug 27 2016 05:04
@tbushman I'm not sure what you mean.
Daniel Wu
@mejorna
Aug 27 2016 05:06
@sunpeng897570 how did i make it an argument?
Tracey Bushman
@tbushman
Aug 27 2016 05:06
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
Do I need to include any other code in the JS section to make it work?
Daniel Wu
@mejorna
Aug 27 2016 05:07
Tracey Bushman
@tbushman
Aug 27 2016 05:08
@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
Why is that?
Tracey Bushman
@tbushman
Aug 27 2016 05:18
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
Well then, I appreciate the saved tears :)
Tracey Bushman
@tbushman
Aug 27 2016 05:19
sorry, I meant $(document).on('click', '#buttonid', function(){...}); instead of $('#buttonid').click(function(){...});
benedict
@benz12
Aug 27 2016 05:21

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
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
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
window.open?
Tracey Bushman
@tbushman
Aug 27 2016 05:27
sounds right. I think so
Edmund To
@edmundtfy
Aug 27 2016 05:28
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
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
what does console.log(num) tell u?
Mike
@SaxManMike
Aug 27 2016 05:36
That it's undefined?
Vivienne Sales
@Natto278
Aug 27 2016 05:37
This message was deleted
'''
CamperBot
@camperbot
Aug 27 2016 05:37
:bulb: to format code use backticks! ``` more info
Edmund To
@edmundtfy
Aug 27 2016 05:38
Hello, does anybody use React? @SaxManMike @tbushman
Tracey Bushman
@tbushman
Aug 27 2016 05:38
@edmundtfy I haven't gotten into React just yet. sooon. sorry
Edmund To
@edmundtfy
Aug 27 2016 05:38
@tbushman never mind ^_^
Tracey Bushman
@tbushman
Aug 27 2016 05:39
@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

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
@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
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
@tbushman thanks, investigating on that!
CamperBot
@camperbot
Aug 27 2016 05:43
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
@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
@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
I was just guessing and haven't looked too closely , sorry
Vivienne Sales
@Natto278
Aug 27 2016 05:47
@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

so do
shift enter
then add

then shift enter

shift-enter gives line breaks between ```s

Vivienne Sales
@Natto278
Aug 27 2016 05:49
Like this?
```
Tracey Bushman
@tbushman
Aug 27 2016 05:49
si
Vivienne Sales
@Natto278
Aug 27 2016 05:50
@tbushman I left those directions at home. I'm sorry.
Tracey Bushman
@tbushman
Aug 27 2016 05:51
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
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

@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
@hacu9 help formatting
help format
CamperBot
@camperbot
Aug 27 2016 05:52
no wiki entry for: format
Michael Karpinski
@karpimpski
Aug 27 2016 05:52
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
@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
@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
@tbushman Are you saying that for then first post of my code today?
Tracey Bushman
@tbushman
Aug 27 2016 05:54
@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
@karpimpski I'M A Little Tea Pot
I need M to be lowercase
Tracey Bushman
@tbushman
Aug 27 2016 05:56
@SaxManMike k momento
@Natto278 I'm not sure what post ?
Mike
@SaxManMike
Aug 27 2016 05:56
@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
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
@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
@hacu9 which exercise is that?
Henry Cabello
@hacu9
Aug 27 2016 06:00
@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
@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
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
@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
I think I see what you mean, I just need to figure out the syntax
nicop
@nicopcat
Aug 27 2016 06:07

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
@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
@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
@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
Title Case a Sentence
i think i just need to add something to the regex
Mike
@SaxManMike
Aug 27 2016 06:11
Well, I got the code working more cleanly, but the Tweeting still isn't working
Henry Cabello
@hacu9
Aug 27 2016 06:11
but idk what so it ignores the '
Tracey Bushman
@tbushman
Aug 27 2016 06:12
@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
@tbushman Did I mess up the syntax on my Tweeting code?
Henry Cabello
@hacu9
Aug 27 2016 06:15
@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
@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
@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
@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
@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
Music is Math — (Boards of Canada) == good album;
CamperBot
@camperbot
Aug 27 2016 06:23
Mike
@SaxManMike
Aug 27 2016 06:23
Whatever, @camperbot
Tracey Bushman
@tbushman
Aug 27 2016 06:24
I'm starting to chat like CamperBot, which means I should retire. Best wishes y'all.
Mike
@SaxManMike
Aug 27 2016 06:25
Thanks @tbushman !
CamperBot
@camperbot
Aug 27 2016 06:25
saxmanmike sends brownie points to @tbushman :sparkles: :thumbsup: :sparkles:
:warning: saxmanmike already gave tbushman points
Vivienne Sales
@Natto278
Aug 27 2016 06:26
@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
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
@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
@Natto278 @tbushman use .hasOwnProperty if you want to test if a property exist or not
docs
Indhu
@Indhusethu
Aug 27 2016 06:30
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

@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
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
@Indhusethu no spaces on the : and \\
Indhu
@Indhusethu
Aug 27 2016 06:34
oh ok @wearenotgroot
greg
@wearenotgroot
Aug 27 2016 06:34
@Indhusethu oh no there was space :smile:
Indhu
@Indhusethu
Aug 27 2016 06:35
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
@Indhusethu nvm
Indhu
@Indhusethu
Aug 27 2016 06:37
nvm??
bibubi
@bibubi
Aug 27 2016 06:37
blob
greg
@wearenotgroot
Aug 27 2016 06:38
@Indhusethu you are working on this right? Escape Sequences in Strings
Indhu
@Indhusethu
Aug 27 2016 06:39
yes
greg
@wearenotgroot
Aug 27 2016 06:39
@Indhusethu try and reset it because they changed that challenge
Indhu
@Indhusethu
Aug 27 2016 06:39
oh no!!:(
greg
@wearenotgroot
Aug 27 2016 06:39
@Indhusethu you should have this (new text)
  • FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
Indhu
@Indhusethu
Aug 27 2016 06:42
yeah i saw just now :)
greg
@wearenotgroot
Aug 27 2016 06:42
@Indhusethu :+1:
Indhu
@Indhusethu
Aug 27 2016 06:42
thanks for ur time:) :+1: @wearenotgroot
CamperBot
@camperbot
Aug 27 2016 06:42
indhusethu sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1469 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Indhu
@Indhusethu
Aug 27 2016 06:43
i got it
greg
@wearenotgroot
Aug 27 2016 06:43
@Indhusethu np
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 06:59
Screen Shot 2016-08-27 at 13.59.10.png
What should I do now? Please help.
greg
@wearenotgroot
Aug 27 2016 07:01
@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
I’ll try.
greg
@wearenotgroot
Aug 27 2016 07:05
@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

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
@kunal47 no return statement inside the switch, just assign the value to answer variable
kunal
@kunal47
Aug 27 2016 07:09
ok thanks
greg
@wearenotgroot
Aug 27 2016 07:09
@kunal47 another thing your case should be numbers, example
case 1 : ....(value of answer should be "alpha")
kunal
@kunal47
Aug 27 2016 07:10
ok
Michael Karpinski
@karpimpski
Aug 27 2016 07:18
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
hi
Liew Xun
@damakuno
Aug 27 2016 07:21
@jamesmillerho the effect can, the on click event, no
jamesmillerho
@jamesmillerho
Aug 27 2016 07:23
@damakuno so is it possible to do the same page with only CSS
Liew Xun
@damakuno
Aug 27 2016 07:24
no
jamesmillerho
@jamesmillerho
Aug 27 2016 07:24
@damakuno ok thanks
CamperBot
@camperbot
Aug 27 2016 07:24
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
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
why -webkit-filter is not working
I want to -webkit-filter: blur
I use Chrome
Anthony Drane
@Antiaccess
Aug 27 2016 07:36
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
@Antiaccess str[i].charCodeAt(0)
Anthony Drane
@Antiaccess
Aug 27 2016 07:46
I'm not following @jamesmillerho
jamesmillerho
@jamesmillerho
Aug 27 2016 07:49
@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
@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
use escape(varname) to escape a string from a sequence
Winter S. Ndolo
@xulenvirp
Aug 27 2016 07:56
@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
escape(myStr);
jamesmillerho
@jamesmillerho
Aug 27 2016 07:58
@xulenvirp var myStr = "FirstLine\n\\SecondLine\\\rThirdLine";
Winter S. Ndolo
@xulenvirp
Aug 27 2016 07:58
oh. Thanks @jamesmillerho @SandeepSafalta
Sandeep
@SandeepSafalta
Aug 27 2016 07:58
puth this below the variable declaration
CamperBot
@camperbot
Aug 27 2016 07:58
: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
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
so am I but i started on Wednesday @SandeepSafalta
Sandeep
@SandeepSafalta
Aug 27 2016 08:01
but i have previous programming experience
hey shaw can i ask you something
Darth Skywalker
@adityaparab
Aug 27 2016 08:03
@xulenvirp : Welcome! :P
@SandeepSafalta : You too :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:04
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
Lifes' too short to be still using php :P
Egoscio
@Egoscio
Aug 27 2016 08:04
^
At least go with node.
Sandeep
@SandeepSafalta
Aug 27 2016 08:05
man i am new in js dev env
college taught us php
Egoscio
@Egoscio
Aug 27 2016 08:05
Node is JS :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:05
i know what is js dont act smart
Darth Skywalker
@adityaparab
Aug 27 2016 08:05
Let me guess, the async philosophy of js is what pisses you off! :D
Sandeep
@SandeepSafalta
Aug 27 2016 08:05
i know some basic of js
Egoscio
@Egoscio
Aug 27 2016 08:05
Acting smart? Alright then
Darth Skywalker
@adityaparab
Aug 27 2016 08:06
Calm down, men! No need to be adversaries here!
Egoscio
@Egoscio
Aug 27 2016 08:06
True, I have better places to invest such an act.
Sandeep
@SandeepSafalta
Aug 27 2016 08:07
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
'no' is not recognized as an internal or external command,
operable program or batch file.
Sandeep
@SandeepSafalta
Aug 27 2016 08:09
oh no
Egoscio
@Egoscio
Aug 27 2016 08:09
Give it a sec to reboot...
Darth Skywalker
@adityaparab
Aug 27 2016 08:10
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
now i am learning about built in dialogue box
may be..
Egoscio
@Egoscio
Aug 27 2016 08:10
bruh you need to put down that code coffee, it's getting too deep in hed
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 08:12
@wearenotgroot thx.
CamperBot
@camperbot
Aug 27 2016 08:12
sohan2infosec sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1472 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
jamesmillerho
@jamesmillerho
Aug 27 2016 08:13
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
@jamesmillerho add jquery on the js settings?
jamesmillerho
@jamesmillerho
Aug 27 2016 08:14
lol
@wearenotgroot thanks
CamperBot
@camperbot
Aug 27 2016 08:14
jamesmillerho sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1473 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Egoscio
@Egoscio
Aug 27 2016 08:15
I wouldn't have thought of that in a million years :+1:
Darth Skywalker
@adityaparab
Aug 27 2016 08:17
@jamesmillerho : You didn't have jQuery included
also, what are you trying to achieve exactly?
jamesmillerho
@jamesmillerho
Aug 27 2016 08:17
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
Sweet!
@jamesmillerho
Darth Skywalker
@adityaparab
Aug 27 2016 08:23
Nice!
@jamesmillerho : I've made a few changes to your button. Take a look.
jamesmillerho
@jamesmillerho
Aug 27 2016 08:28
@adityaparab I just added cursor: pointer
Darth Skywalker
@adityaparab
Aug 27 2016 08:28
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
@adityaparab great. thanks
CamperBot
@camperbot
Aug 27 2016 08:31
jamesmillerho sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 633 | @adityaparab |http://www.freecodecamp.com/adityaparab
Raj
@RajKumar1605
Aug 27 2016 08:47
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
That's not legible, please beautify it and format using triple back ticks
'''
CamperBot
@camperbot
Aug 27 2016 08:48
:bulb: to format code use backticks! ``` more info
Egoscio
@Egoscio
Aug 27 2016 08:49
Or use gist.github.com or hastebin.com
Milos Gemaljevic
@havocZz
Aug 27 2016 09:08
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
Show ur code @havocZz
Milos Gemaljevic
@havocZz
Aug 27 2016 09:09

@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
I find it actually very difficult to do :https://www.canva.com/
Milos Gemaljevic
@havocZz
Aug 27 2016 09:09
that is default code, i didnt change anything
Ademola Adegbuyi
@ooade
Aug 27 2016 09:10
@havocZz OKay! Do you know the celcius to farenheit formula??
jamesmillerho
@jamesmillerho
Aug 27 2016 09:10
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
@marhyorh its says here Celsius*(9/5)+32, if Im not mistaken
Ademola Adegbuyi
@ooade
Aug 27 2016 09:12
@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
what about my code ?
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 09:22
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
@marhyorh ty very much
CamperBot
@camperbot
Aug 27 2016 09:23
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
@havocZz :+1:
Egoscio
@Egoscio
Aug 27 2016 09:25
@Sohan2infoSec Can you tell us what you don't understand?
Ademola Adegbuyi
@ooade
Aug 27 2016 09:29
@Sohan2infoSec add the number, which is item to the end of the array arr. Start with that
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 09:29
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
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
@Sohan2infoSec
check /FreeCodeCamp chat
@Sohan2infoSec yeah, you need to return the value that is removed
Brendan Kinahan
@BKinahan
Aug 27 2016 09:40
morning campers o/
Ademola Adegbuyi
@ooade
Aug 27 2016 09:41
morning... @BKinahan
FreddySun
@sunpeng897570
Aug 27 2016 09:54
@BKinahan morning my friend
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:09
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
This message was deleted
Markus Kiili
@Masd925
Aug 27 2016 10:15
@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
@Masd925 howdy o/
Markus Kiili
@Masd925
Aug 27 2016 10:16
@BKinahan Yo!
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:16
@Masd925 U mean .push and .shift?
Markus Kiili
@Masd925
Aug 27 2016 10:17
@Sohan2infoSec Yes.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:17
"function should then return the element that was removed.” How can I return it?
@Masd925
Markus Kiili
@Masd925
Aug 27 2016 10:18
@Sohan2infoSec Check what is the return value of shift method.
Milos
@Milos2709
Aug 27 2016 10:21
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
@Masd925 yeah, I just wonder how can I return that “removed” value?
Because, it is disappeared :|.
Walid Ashri
@walidashri
Aug 27 2016 10:23
hi all
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:23
@AshriSoft hi :D.
Markus Kiili
@Masd925
Aug 27 2016 10:23
@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

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
@Masd925 Haha, it sounds nice. But can u give me the real solution?
Markus Kiili
@Masd925
Aug 27 2016 10:25
@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
@Masd925 yes I know how this can be done :(
Henry Cabello
@hacu9
Aug 27 2016 10:27
Im on the truncate a string challenge and this is my code
Anthony Drane
@Antiaccess
Aug 27 2016 10:27
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

}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
@Sohan2infoSec Just put the return keyword before the statement that uses .shift().
Henry Cabello
@hacu9
Aug 27 2016 10:28
instead of returning A... it returns ...
truncateString("Absolutely Longer", 2) should return "Ab..." it returns Absolutely Longe...
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:29
@Masd925 oh, I did not think about this. Thx you.
CamperBot
@camperbot
Aug 27 2016 10:29
sohan2infosec sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2372 | @masd925 |http://www.freecodecamp.com/masd925
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:29
@Masd925 I’m so bad :(.
Markus Kiili
@Masd925
Aug 27 2016 10:30
@Sohan2infoSec It just takes some time learn these things.
kwal0203
@kwal0203
Aug 27 2016 10:30
hey anybody in here know C?
Henry Cabello
@hacu9
Aug 27 2016 10:31
Anyone? D: it keeps silicing where i dont want it to xd
Milos
@Milos2709
Aug 27 2016 10:33
thanks @Masd925 I'll try something out
CamperBot
@camperbot
Aug 27 2016 10:33
milos2709 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2373 | @masd925 |http://www.freecodecamp.com/masd925
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:33
@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
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
@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
 ``` 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
@Masd925 Yeah, but what is the relation of that with the topic “queue” of the lesson?
Henry Cabello
@hacu9
Aug 27 2016 10:37
it feels like the num var isnt reaching the bottom part
Markus Kiili
@Masd925
Aug 27 2016 10:37
@Sohan2infoSec A queue can be implemented with a JS array.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:38
Screen Shot 2016-08-27 at 17.38.24.png
What does this requirement mean?
Markus Kiili
@Masd925
Aug 27 2016 10:40
@Sohan2infoSec It tests whether the function does what it should.
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:40

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
@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
@Masd925 .hasOwnProperty only allows me to check the existance,not the value
Markus Kiili
@Masd925
Aug 27 2016 10:42
@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
@Masd925 oh,you're right. By using .hasOwnProperty iterating through the whole array is no longer necessary
balakrishna
@balabkk
Aug 27 2016 10:44

// 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
@Masd925 thank you
CamperBot
@camperbot
Aug 27 2016 10:45
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
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
I have some issues about codepen. Can anybody help me ?
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 10:51
@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
@shxdow The last requirement deals with contact not having property key stored in prop.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:56
@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
@Sohan2infoSec No, they are not equal.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:57
But they still let me pass the lesson?
Markus Kiili
@Masd925
Aug 27 2016 10:58
@Sohan2infoSec No it doesn't pass. Some problem with the page most probably.
Sohan2infoSec
@Sohan2infoSec
Aug 27 2016 10:58
@Masd925 oh, it’s not. Just check again. Thank you.
CamperBot
@camperbot
Aug 27 2016 10:58
sohan2infosec sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: sohan2infosec already gave masd925 points
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:02
@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
@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
Hi. hows everybody?
Telianth
@Telianth
Aug 27 2016 11:14
@letorruella I got rushed by a swarm of mosquitoes, it wasn't pleasant :|
Liman Abba
@limanCode
Aug 27 2016 11:15
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
@shxdow contacts[i][firstName] <- quotes needed on firstName here
@Masd925 why are quotes needed
anurag
@anuragparmar
Aug 27 2016 11:18
need some help in this task Convert Celsius to Fahrenheit
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:18
@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
@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
can any one expalin me golf code
please
anurag
@anuragparmar
Aug 27 2016 11:35
i m stuck at this challenge Convert Celsius to Fahrenheit
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:41
show the code
Nitesh
@nidsnitesh
Aug 27 2016 11:41
@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
ah ok you're starting out. One moment I have to look at the challenge
Nitesh
@nidsnitesh
Aug 27 2016 11:43
?????
ok
「 ㅤㅤㅤ ㅤㅤㅤ ㅤㅤㅤ 」
@shxdow
Aug 27 2016 11:46
@Masd925 oh I see. thank you for helping me. passed it.
CamperBot
@camperbot
Aug 27 2016 11:46
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
@shxdow Good. Next do it with .reduce() method ;)
Nitesh
@nidsnitesh
Aug 27 2016 11:48
help meeeeeeeeeeeeeeeee
CamperBot
@camperbot
Aug 27 2016 11:48
no wiki entry for: meeeeeeeeeeeeeeeee
Nitesh
@nidsnitesh
Aug 27 2016 11:49
@alexanderkopke??
Alexander Køpke
@alexanderkopke
Aug 27 2016 11:49
@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
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
@nidsnitesh the first could be something like: if (strokes === 1){ return "Hole-in-one!"}
Alexander Køpke
@alexanderkopke
Aug 27 2016 12:01
@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
@alexanderkopke ooooooooo lemme try
Alexander Køpke
@alexanderkopke
Aug 27 2016 12:04
FirstLine
\SecondLine\
ThirdLine
the output should look like that I think
Linh Nguyen My
@pinglinh
Aug 27 2016 12:04
var myStr = 'FirstLine\n \SecondLine\ \rThirdLine';
Stephen James
@sjames1958gm
Aug 27 2016 12:05
@pinglinh no spaces - and backslash is escpaed by a second backslash - see the table
Linh Nguyen My
@pinglinh
Aug 27 2016 12:05
var myStr = 'FirstLine\n \\SecondLine\\ \rThirdLine’;
nearly working
Stephen James
@sjames1958gm
Aug 27 2016 12:05
@pinglinh no spaces
Linh Nguyen My
@pinglinh
Aug 27 2016 12:05
@sjames1958gm okay lemme try
@sjames1958gm OMG thank you!!!!!!!!!!!!
CamperBot
@camperbot
Aug 27 2016 12:05
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
@alexanderkopke @sjames1958gm thanks for your help guys :D
CamperBot
@camperbot
Aug 27 2016 12:06
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
@pinglinh :+1:
BlueExe
@BlueExe
Aug 27 2016 12:11

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
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
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
@txsrangers fahrenheit = celsius *9 / 5 + 32;
Linh Nguyen My
@pinglinh
Aug 27 2016 12:12
@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
Hmm...the question doesn't read that way, but I'll try that.
BlueExe
@BlueExe
Aug 27 2016 12:14
@pinglinh The order of the factors does not alter the product
Kevin
@txsrangers
Aug 27 2016 12:15
true, but I wouldn't think the parenthesis would cause a problem.
BlueExe
@BlueExe
Aug 27 2016 12:15
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
Actually, the parenthesis were fine. I was spelling fahrenheit wrong. lol.
thanks for the help
Linh Nguyen My
@pinglinh
Aug 27 2016 12:16
@BlueExe yeah I was just following the order at which the question was worded
BlueExe
@BlueExe
Aug 27 2016 12:17

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
@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

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
@BlueExe Don't add spaces to the test function call.
BlueExe
@BlueExe
Aug 27 2016 12:19
HOW?
Markus Kiili
@Masd925
Aug 27 2016 12:19
Alter the function code only.
@BlueExe "A large "+myNoun+" ate my dinner." In that fassion.
BlueExe
@BlueExe
Aug 27 2016 12:21
I dont understand
Markus Kiili
@Masd925
Aug 27 2016 12:22
@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

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
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
@kristerChawa I believe there are no bugs there. The description used to be somewhat confusing though.
kristerChawa
@kristerChawa
Aug 27 2016 12:34
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
@kristerChawa Try removing both the console.logs.
kristerChawa
@kristerChawa
Aug 27 2016 12:36
I've already tried it but still not working.
Markus Kiili
@Masd925
Aug 27 2016 12:36
@kristerChawa Post your code here.
kristerChawa
@kristerChawa
Aug 27 2016 12:37
blob
Markus Kiili
@Masd925
Aug 27 2016 12:39
@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
@kristerChawa It says do not create a global myVar which you have
Joseph
@revisualize
Aug 27 2016 12:40
Good morning.
Stephen James
@sjames1958gm
Aug 27 2016 12:41
@revisualize Hey early out there in WA
Joseph
@revisualize
Aug 27 2016 12:41
@kristerChawa There is no bug. You have a global variable.
kristerChawa
@kristerChawa
Aug 27 2016 12:41
@sjames1958gm I didn't create a global myVar at first and it's still not working .
Joseph
@revisualize
Aug 27 2016 12:41
@kristerChawa Line 8.
Remove line 8
jcfa01
@jcfa01
Aug 27 2016 12:43
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
// 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
@jcfa01 Read the arguments object link -
jcfa01
@jcfa01
Aug 27 2016 12:44
okay thanks
Joseph
@revisualize
Aug 27 2016 12:46
@jcfa01 You do realize that those links are there to help you?
jcfa01
@jcfa01
Aug 27 2016 12:48
@revisualize i check filter, i thought i knew arguments, guess not haha
Stephen James
@sjames1958gm
Aug 27 2016 12:49
@jcfa01 arguments is going to be a new and important concept - used in later challenges.
Dany Din
@danydin
Aug 27 2016 12:55
@sjames1958gm hey
Stephen James
@sjames1958gm
Aug 27 2016 12:55
@danydin hello