These are chat archives for FreeCodeCamp/HelpJavaScript

18th
Aug 2016
greg
@wearenotgroot
Aug 18 2016 00:00
@pchelpme
  • no value assigned when declared
@pchelpme changed it to
var a = 6; //<----- you declared a variable(using var) with an initial value of 6
...
pchelpme
@pchelpme
Aug 18 2016 00:01

var a = 6;
var b = 15;
var c = "I am a String";

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

@wearenotgroot still error
why?
greg
@wearenotgroot
Aug 18 2016 00:02
@pchelpme supposed to be 'I am a' on c
  • Initialize the three variables a, b, and c with 5, 10, and "I am a"
pchelpme
@pchelpme
Aug 18 2016 00:02
never mind got it
@wearenotgroot tahnkx any way
greg
@wearenotgroot
Aug 18 2016 00:03
@pchelpme :+1:
pchelpme
@pchelpme
Aug 18 2016 00:03
luv u
greg
@wearenotgroot
Aug 18 2016 00:03
@pchelpme thanks
CamperBot
@camperbot
Aug 18 2016 00:03
wearenotgroot sends brownie points to @pchelpme :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for pchelpme
greg
@wearenotgroot
Aug 18 2016 00:03
:smile:
Joel Santos
@St3ps
Aug 18 2016 00:03
So, let's say i have an html element that i've set up with jquery with the following attributes:
<div y="0" x="0" class="col-md-4 cell"></div>
Now, i have 8 more of these with different y and x attributes. These are, analog to what would be coordinates. How would i, through jquery, access a specific div? Like if i wanted <div> with x=2 and y =1?
Henrik Hansen
@MathManiac
Aug 18 2016 00:05
you need to give each of them an id
<div id="something"> remember different ids
then you call $(".something")
Virgilio Concepcion
@Vachman96
Aug 18 2016 00:09
it normal to make such a jump between challenges? Record Collection - Javascript is kinda tricky.
Not looking for help now, I'm just doing a fast review
Later i'll ask
greg
@wearenotgroot
Aug 18 2016 00:13
@Vachman96 well up to you. you can stick with a challenge until you solve it or you can do something else then come back to it.
dont worry this one is a bit tricky for a lot of people
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 00:14
@St3ps $('div[x="0"]');
Virgilio Concepcion
@Vachman96
Aug 18 2016 00:14
This is the one that I need to do, this is where i'm at.
Maxx
@JMiller1021
Aug 18 2016 00:14
@wearenotgroot Thank you for the link. the \W included underscores, and it took me a minute to figure it out. Thanks again, I'll work on that site a little more.
CamperBot
@camperbot
Aug 18 2016 00:14
jmiller1021 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1387 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
Virgilio Concepcion
@Vachman96
Aug 18 2016 00:14
But right now don't have the time to sit down and try it.
greg
@wearenotgroot
Aug 18 2016 00:15
@JMiller1021 yeah \W is for non-word characters, but underscore is considered word character, so you need to filter it out as well
/[\W_]/g
Virgilio Concepcion
@Vachman96
Aug 18 2016 00:15
@wearenotgroot Will come back later, See ya guys.
Joel Santos
@St3ps
Aug 18 2016 00:15
@stonefmagiecurata lol i was just about to type it in!
@stonefmagiecurata , @MathManiac the solution i was looking for was, something like this -- $(".cell[x='0'][y='0']").text("sometext");
@stonefmagiecurata @MathManiac thanks guys
CamperBot
@camperbot
Aug 18 2016 00:16
st3ps sends brownie points to @stonefmagiecurata and @mathmaniac :sparkles: :thumbsup: :sparkles:
:cookie: 316 | @stonefmagiecurata |http://www.freecodecamp.com/stonefmagiecurata
:cookie: 172 | @mathmaniac |http://www.freecodecamp.com/mathmaniac
greg
@wearenotgroot
Aug 18 2016 00:16
@Vachman96 :+1:
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 00:16
@St3ps :+1:
Maxx
@JMiller1021
Aug 18 2016 00:17
@wearenotgroot That is what I ended up doing. the bit I didn't understand was using the brackets. Thank you again for your help.
CamperBot
@camperbot
Aug 18 2016 00:17
jmiller1021 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:warning: jmiller1021 already gave wearenotgroot points
greg
@wearenotgroot
Aug 18 2016 00:17
@JMiller1021 np
Angel J Piscola
@Redmega
Aug 18 2016 00:19
Hey y'all
thierrybgentile
@thierrybgentile
Aug 18 2016 00:21

hey everybody! need help, i would greatly appreciate. What's not working here:
var cloune = document.querySelector('.cloune');
var button = document.getElementByID('button');

button.addEventListener('click', montrerCloune);

function montrerCloune() {
cloune.style.transform = "";
}

Tica Alexandru Adrian
@LunyAlex
Aug 18 2016 00:21

https://www.freecodecamp.com/challenges/caesars-cipher


function rot13(str) { // LBH QVQ VG!

var tempArr = [];
var str2 = "";  


  for (var i = 0; i < str.length; i++)
    {
     tempArr.push(str.charCodeAt(i));
     tempArr[i] = (tempArr[i] - 13);   
     str2 += String.fromCharCode(tempArr[i]);
      }



return str2;
}

Any idea what I may be doing wrong? It returns "F8EE-C5DE-CAM6"

thierrybgentile
@thierrybgentile
Aug 18 2016 00:22
something goes wrong around the event listener
Angel J Piscola
@Redmega
Aug 18 2016 00:22
@LunyAlex Check that you're staying within the bounds of the 26 letter alphabet with your char codes
Tica Alexandru Adrian
@LunyAlex
Aug 18 2016 00:23

@Redmega Thank you

Appreciate it

CamperBot
@camperbot
Aug 18 2016 00:23
lunyalex sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 81 | @redmega |http://www.freecodecamp.com/redmega
Anand Jayaram
@AJ-72
Aug 18 2016 00:27
Hi All
I am trying to run the escape sequence test in javascript
My code is var myStr="\Firstline"; to print \Firstline.
But it prints the \ instead of escaping
ah the chat escapes the "\"
Angel J Piscola
@Redmega
Aug 18 2016 00:29
Put your code in code
with three ```
console.log('like this\n');
Anand Jayaram
@AJ-72
Aug 18 2016 00:29
var myStr="\Firstline"; // Change this line
oh okay
Angel J Piscola
@Redmega
Aug 18 2016 00:29
``` before and after
on its own line
Anand Jayaram
@AJ-72
Aug 18 2016 00:29
'''var myStr="\Firstline"; // Change this line'''
CamperBot
@camperbot
Aug 18 2016 00:29
:bulb: to format code use backticks! ``` more info
Angel J Piscola
@Redmega
Aug 18 2016 00:30
Those are apostophes, not backticks :)
Anand Jayaram
@AJ-72
Aug 18 2016 00:30
:D
var myStr="\\Firstline"; // Change this line
Angel J Piscola
@Redmega
Aug 18 2016 00:30
There you go. Thats "inline code" which is fine for a single line
If you want a block of code you need to put each set of backticks on their own lines
Kantra
@removed~kantrakantra
Aug 18 2016 00:31

Hey guys, I'm a little but confused by .indexOf

I've read about it and I'm attempting to understand it. I was wondering if anybody here could maybe put it into more layman terms for me. I'm having a hard time grasping the part with the integers (0,-1)

Angel J Piscola
@Redmega
Aug 18 2016 00:31
Anywho..
Anand Jayaram
@AJ-72
Aug 18 2016 00:31
okay, understood the backtick now. Thanks!
Angel J Piscola
@Redmega
Aug 18 2016 00:31
Sure @kantrakantra what exactly is it you don't get? Can you tell me what would happen if I did [1,2,3].indexOf(2)?
@AJ-72 I'm not familiar with that challenge, what are you trying to escape? You want to remove any character that comes after a \?
Anand Jayaram
@AJ-72
Aug 18 2016 00:32
I am trying to print a \ along with the string
thierrybgentile
@thierrybgentile
Aug 18 2016 00:32
Nobody?
Anand Jayaram
@AJ-72
Aug 18 2016 00:33
This is what I have to print FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
Angel J Piscola
@Redmega
Aug 18 2016 00:33
@thierrybgentile Oh, didnt notice you asked a question. Try putting your code in a code block next time :)
thierrybgentile
@thierrybgentile
Aug 18 2016 00:33
oops sorry haha
Angel J Piscola
@Redmega
Aug 18 2016 00:34
@AJ-72 I either skipped that challenge or I haven't gotten to it yet, so I'm not familiar with the user story. Maybe someone else online can help with your problem..

@thierrybgentile Here's your code:

var cloune = document.querySelector('.cloune');
var button = document.getElementByID('button');
button.addEventListener('click', montrerCloune);
function montrerCloune() {
cloune.style.transform = "";
}

What exactly is the issue you're facing?

The first thing I'd check for is to make sure your <button> has an id="button"
Kantra
@removed~kantrakantra
Aug 18 2016 00:36
@Redmega I suppose what I don't understand is what the .indexOf returns.
thierrybgentile
@thierrybgentile
Aug 18 2016 00:37
@Redmega I've tried checking my two vars in the console, the output is fine so it's not in the variable definition
Angel J Piscola
@Redmega
Aug 18 2016 00:38
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
@kantrakantra
thierrybgentile
@thierrybgentile
Aug 18 2016 00:38
@Redmega when i click the button the clown should show up (because of the css) but it doesn't
greg
@wearenotgroot
Aug 18 2016 00:38

@thierrybgentile missing . on montrer

montrer {
  transform: none;
}

should be

.montrer {
  transform: none;
}
Kantra
@removed~kantrakantra
Aug 18 2016 00:39
@Redmega Ok that helps. Then what is the use of including an integer value in the brackets, such as with:
'Blue Whale'.indexOf('Whale', 5);
thierrybgentile
@thierrybgentile
Aug 18 2016 00:40
@wearenotgroot oh thank you i tried another approach in my function and i missed that but it doesn't solve the problem
CamperBot
@camperbot
Aug 18 2016 00:40
thierrybgentile sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1388 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
greg
@wearenotgroot
Aug 18 2016 00:41
@thierrybgentile it's working here. the problem was on you css. you didnt create the class properly so it couldnt add it
Angel J Piscola
@Redmega
Aug 18 2016 00:41
@thierrybgentile I was gonna say, if you inspect it with the dev tools and give it a z-index of 999, it shows itself behind the button ;)
thierrybgentile
@thierrybgentile
Aug 18 2016 00:41
@wearenotgroot @Redmega yeah you're right ! thank you both
CamperBot
@camperbot
Aug 18 2016 00:41
thierrybgentile sends brownie points to @wearenotgroot and @redmega :sparkles: :thumbsup: :sparkles:
:warning: thierrybgentile already gave wearenotgroot points
:cookie: 83 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 00:41
fromIndex
The index to start the search at. If the index is greater than or equal to the array's length, -1 is returned, which means the array will not be searched. If the provided index value is a negative number, it is taken as the offset from the end of the array. Note: if the provided index is negative, the array is still searched from front to back. If the calculated index is less than 0, then the whole array will be searched. Default: 0 (entire array is searched).
so if i [1,2,3,4,5].indexOf(1,2), it'll return -1 since 1 does not exist after index 2
greg
@wearenotgroot
Aug 18 2016 00:43
anyways going to sleep, GL and Happy Coding to everyone!
Angel J Piscola
@Redmega
Aug 18 2016 00:49
@kantrakantra Got it?
It's not necessary, you can leave it off since it's an optional argument and will default to 0
Norvin Burrus
@ndburrus
Aug 18 2016 01:02
@AJ-72 :sparkles:
  • need to take the given string, here:
    "FirstLine newline backslash SecondLine backslash carriage-return ThirdLine" (ignore the spacing) and carefully replace the appropriate text (bold words) with the escape coding (use the Code/Output chart)...
lettda
@lettda
Aug 18 2016 01:07
new issue, i fixed the button to give me the prompt and clear the grid, but now nothing shows up
but the Dev tools say there are created rows
Norvin Burrus
@ndburrus
Aug 18 2016 01:13
@AJ-72 is it resolved?
Nkwain Peregrine
@nperegrine
Aug 18 2016 01:27
Hey guys! Please i need some help with the "Record Collection" Javascript challenge
Can't seem to pass the last step
help start
CamperBot
@camperbot
Aug 18 2016 01:28

:point_right: android development getting started [wiki]

Getting started with Android Development

Today Android has become the leading Operating System being used in various devices, like mobile phone, tablets, watches, TV, cars and many more. It powers more than a billion devices all over the globe. It is based on the Linux kernel. Android has been the best selling OS on tablets since 2013, and on smartphones it is dominant by any metric.

:pencil: read more about android development getting started on the FCC Wiki

Nkwain Peregrine
@nperegrine
Aug 18 2016 01:28
Can any body help me please.. After updateRecords(2548, "tracks", ""), tracks should not be set
Used this line of code but don't seem to be working.. else if(value === ""){
collection[id].tracks = "";
}
Ken Haduch
@khaduch
Aug 18 2016 01:32
@nperegrine - delete collection[id].tracks ; is probably what you want
Angel J Piscola
@Redmega
Aug 18 2016 01:33
Back from my jog
Ken Haduch
@khaduch
Aug 18 2016 01:34
This message was deleted
This message was deleted
This message was deleted
Nkwain Peregrine
@nperegrine
Aug 18 2016 01:34
:smile: :smile: :smile: Thanks a lot @khaduch Been stuck on that exercise for almost an hour now... Thanks very much :+1:
CamperBot
@camperbot
Aug 18 2016 01:34
nperegrine sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1552 | @khaduch |http://www.freecodecamp.com/khaduch
Joel Santos
@St3ps
Aug 18 2016 01:34
Trying to set a value to an element, but something isn't working
    setVal: function(_x, _y, val) {


        $(".cell[x='0'][y='0']").text(val); /* this works */
         $(".cell[x=_x][y=_y]").text(val); /* setVal('0', '0', 'X') does not work. neither will passing the arguments without the quotes.  any idea why? */


    },
eduwin7
@eduwin7
Aug 18 2016 01:39
all, I need help.
i am on Factorialize a number
can anyone help
?
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 01:48
@St3ps because they are parameters, you need to concatenate them
$(".cell[x=" + _x + "][y=" + _y + "]").text(val);
Joel Santos
@St3ps
Aug 18 2016 01:51
@stonefmagiecurata thank you! I mean, I guess i didn't think of the $ line as if it was a string?
CamperBot
@camperbot
Aug 18 2016 01:51
st3ps sends brownie points to @stonefmagiecurata :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @stonefmagiecurata |http://www.freecodecamp.com/stonefmagiecurata
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 01:53
@St3ps yeah, the selector inside the () is a string, that's why you need to concatenate it with the parameters
Angel J Piscola
@Redmega
Aug 18 2016 01:53
@eduwin7 What help do you need? would be useful to see what code you have and what you need help with...
Kantra
@removed~kantrakantra
Aug 18 2016 01:55
@Redmega Ok thx. I think I understand
CamperBot
@camperbot
Aug 18 2016 01:55
kantrakantra sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 84 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 01:55
@stonefmagiecurata If you're not worried about browser compatibility you can use backticks too. $(\.cell[x=${_x}][y=${_y}]`.text(val);`
Whoops
Kantra
@removed~kantrakantra
Aug 18 2016 01:55
Can anybody spot whats wrong with my code:
function mutation(arr) {
  var test1 = arr[0];
  var test2 = arr[1];
  for(i=0; i>test1.length; i++ ){
    if(test2.indexOf(test1[i]) > 0){
      return true;
    }
    else {
      return false;
    }
  }


}

mutation(["hello", "hey"]);
eduwin7
@eduwin7
Aug 18 2016 01:55
Hi I really need help
Factorialize a Number
Angel J Piscola
@Redmega
Aug 18 2016 01:55
@kantrakantra What index do arrays start at?
eduwin7
@eduwin7
Aug 18 2016 01:56
Can anyone help with that problem?
?
Sabrina Ferguson
@itsacoyote
Aug 18 2016 01:56
@eduwin7 what's the issue you're having so far?
eduwin7
@eduwin7
Aug 18 2016 01:57
I can't get all right at one time
Joel Santos
@St3ps
Aug 18 2016 01:57
@stonefmagiecurata Ah, now it makes sense...
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 01:57
@Redmega is that some ES6 black magic thing? :D
@St3ps :+1:
eduwin7
@eduwin7
Aug 18 2016 01:57
this is my code

function factorialize(num) {
return num 1234 ;
}

factorialize(5);

function factorialize(num) {
return num 1234 ;
Angel J Piscola
@Redmega
Aug 18 2016 01:58
This message was deleted
CamperBot
@camperbot
Aug 18 2016 01:58
no wiki entry for: backticks
Angel J Piscola
@Redmega
Aug 18 2016 01:58
This message was deleted
CamperBot
@camperbot
Aug 18 2016 01:58
no wiki entry for: backtic
Angel J Piscola
@Redmega
Aug 18 2016 01:58
This message was deleted
This message was deleted
CamperBot
@camperbot
Aug 18 2016 01:59
no wiki entry for: backtick
Angel J Piscola
@Redmega
Aug 18 2016 01:59
=/
Moisés Man
@moigithub
Aug 18 2016 01:59
'
Sabrina Ferguson
@itsacoyote
Aug 18 2016 01:59
@eduwin7 are you trying to return num 1234 in the function? From what I'm reading
Moisés Man
@moigithub
Aug 18 2016 01:59
'''
CamperBot
@camperbot
Aug 18 2016 01:59
:bulb: to format code use backticks! ``` more info
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 01:59
@Redmega even camperbot is unfamiliar with it :D
Angel J Piscola
@Redmega
Aug 18 2016 01:59
Thank you @moigithub
CamperBot
@camperbot
Aug 18 2016 01:59
redmega sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1931 | @moigithub |http://www.freecodecamp.com/moigithub
eduwin7
@eduwin7
Aug 18 2016 01:59
this here factorialize(5) should return a number.
factorialize(5) should return 120.
factorialize(10) should return 3628800.
factorialize(20) should return 2432902008176640000
factorialize(5) should return a number.
factorialize(5) should return 120.
factorialize(10) should return 3628800.
factorialize(20) should return 2432902008176640000
Angel J Piscola
@Redmega
Aug 18 2016 01:59
@eduwin7 use backticks to format your code, like @camperbot said
Moisés Man
@moigithub
Aug 18 2016 02:00
help format
CamperBot
@camperbot
Aug 18 2016 02:00

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Angel J Piscola
@Redmega
Aug 18 2016 02:00
@moigithub THATS what I was talking about
Moisés Man
@moigithub
Aug 18 2016 02:00
:+1: :)
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:01
oh my god guys the chat box is filled with camperbot crap XD
eduwin7
@eduwin7
Aug 18 2016 02:01

\\
function factorialize(num) {
return num 1234 ;
}

factorialize(5);

Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:01
@eduwin7 so are you familiar with the factorial algorithm or just stumped on how to start overall?
eduwin7
@eduwin7
Aug 18 2016 02:02
I can make the 5 equal 120 but then how do I get them all at the same time without deleted the first code
Angel J Piscola
@Redmega
Aug 18 2016 02:03
@eduwin7 Is this the first challenge you're attempting on FreeCodeCamp?
eduwin7
@eduwin7
Aug 18 2016 02:04
no. Algorithm
pchelpme
@pchelpme
Aug 18 2016 02:04
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
help plz
CamperBot
@camperbot
Aug 18 2016 02:04
no wiki entry for: plz
pchelpme
@pchelpme
Aug 18 2016 02:04
i have no idea, write me an equation
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:04
@eduwin7 okay, so maybe lets try this from the start, mind if I send you a direct message?
pchelpme
@pchelpme
Aug 18 2016 02:04
cuz im bat with words
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
eduwin7
@eduwin7
Aug 18 2016 02:04
okay. cool
Angel J Piscola
@Redmega
Aug 18 2016 02:04
@pchelpme Please don't spam :) What is the issue you're having?
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:05
@pchelpme we can't just give you the answer lol
pchelpme
@pchelpme
Aug 18 2016 02:05
ok sry -.-
not the answer
eduwin7
@eduwin7
Aug 18 2016 02:05
thanks @itsacoyote
CamperBot
@camperbot
Aug 18 2016 02:05
eduwin7 sends brownie points to @itsacoyote :sparkles: :thumbsup: :sparkles:
:cookie: 368 | @itsacoyote |http://www.freecodecamp.com/itsacoyote
pchelpme
@pchelpme
Aug 18 2016 02:05
but the formula
Norvin Burrus
@ndburrus
Aug 18 2016 02:05
@pchelpme :sparkles:
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32. (per the instructions)
we can rewrite the equation/formula to:
Fahrenheit = Celsius(9/5), plus + 32.
which is F = C(9/5) + 32.
alright, so we need to convert this formula to code!
pchelpme
@pchelpme
Aug 18 2016 02:05
cuz i had it up side down
ty
i tought was c = f(9/5) + 32
eduwin7
@eduwin7
Aug 18 2016 02:06
@itsacoyote where do I see the direct messages?
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:06
I swear, sometimes I think what one has to do is just summon @ndburrus and he can solve all your problems away
It's the best
pchelpme
@pchelpme
Aug 18 2016 02:07
@ndburrus got it coach
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:07
@eduwin7 are you on gitter or messaging from freecodecamp challenge?
eduwin7
@eduwin7
Aug 18 2016 02:07
yes.
Norvin Burrus
@ndburrus
Aug 18 2016 02:07
@itsacoyote <~~~ is top of the food chain :sparkles:
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:07
:thumbsup:
@eduwin7 well, I guess we can try and explain from here.
Norvin Burrus
@ndburrus
Aug 18 2016 02:08
@pchelpme excellent! nice job! :palm_tree:
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:08
@eduwin7 so your code is passing the first requirement because it is returning a number, but it's not correct in doing any calculation to complete the other requirements.
Vince
@vnorton93
Aug 18 2016 02:09
Has anyone already done the card counting function tutorial? I need to make a function that increments when the card is in a certain set of perimeters and decrement when the card is in another set of perimeters while also displaying if the player should bet or hold.. Idk if I should use a switch function or if an else statements to solve :/
Sabrina Ferguson
@itsacoyote
Aug 18 2016 02:10
@vnorton93 I believe either one works, whichever you feel more comfortable with? Though I think the progress of those challenges your around learning to use switch statements.
Norvin Burrus
@ndburrus
Aug 18 2016 02:13

@vnorton93
these may be helpful: :sparkles:
if/else

switch

Michael Thomas
@mthoma5
Aug 18 2016 02:13
For the record collection problen did people use if/else functions or switch statemnts?
Angel J Piscola
@Redmega
Aug 18 2016 02:13
@mthoma5 I'v seen most people use if/elses when they post here
Doesn't mean thats the best or right way to do it, mind you
Michael Thomas
@mthoma5
Aug 18 2016 02:14
@Redmega yeah felt the same
Vince
@vnorton93
Aug 18 2016 02:14
@itsacoyote Thank you, I've tried to attempt both but they seem a little confusing when I try to set it up. But, you're right I've been on the switch functions so I'll try to focus more towards that. I just know certain tutorials require past knowledge so I wanted a second opinion :)
CamperBot
@camperbot
Aug 18 2016 02:14
vnorton93 sends brownie points to @itsacoyote :sparkles: :thumbsup: :sparkles:
:cookie: 369 | @itsacoyote |http://www.freecodecamp.com/itsacoyote
Michael Thomas
@mthoma5
Aug 18 2016 02:14
just thought maybe there was a better was of doin it
Angel J Piscola
@Redmega
Aug 18 2016 02:14
Theres usually a better way to do most things ;)
Kantra
@removed~kantrakantra
Aug 18 2016 02:14
@Redmega they start at 0 if I'm not mistaken
Vince
@vnorton93
Aug 18 2016 02:14
@ndburrus Thank you :)
CamperBot
@camperbot
Aug 18 2016 02:14
vnorton93 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1654 | @ndburrus |http://www.freecodecamp.com/ndburrus
Angel J Piscola
@Redmega
Aug 18 2016 02:15
@kantrakantra That's true. So when you check if your index exists, what happens if its the first element? It will return 0 right?
Norvin Burrus
@ndburrus
Aug 18 2016 02:15
@vnorton93 you're welcome! enjoy! :palm_tree:
Angel J Piscola
@Redmega
Aug 18 2016 02:15
Look at what you're evaluating and how 0 may pass or fail that condition
Vince
@vnorton93
Aug 18 2016 02:23

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}

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

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

Thank you all for the help, I decided to use both haha :)

And I finally hit 200!
Norvin Burrus
@ndburrus
Aug 18 2016 02:28
@vnorton93 nice work! way to go! :palm_tree:
congrats!!
Vince
@vnorton93
Aug 18 2016 02:29
@ndburrus Thank you :)
CamperBot
@camperbot
Aug 18 2016 02:29
vnorton93 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: vnorton93 already gave ndburrus points
Norvin Burrus
@ndburrus
Aug 18 2016 02:29
@vnorton93 you're welcome :+1:
Kantra
@removed~kantrakantra
Aug 18 2016 02:32

@Redmega

function mutation(arr) {
  var test = arr[1].toLowerCase();
  var target = arr[0].toLowerCase();
  for (i=0;i<test.length;i++){
    if (target.indexOf(test[i]) < 0){
      return false;
    }
  else{
      return true;
  }

  }

}

mutation(["hello", "hey"]);

Ok, I feel like this should be correct but it's still not passing.

Angel J Piscola
@Redmega
Aug 18 2016 02:34
@kantrakantra Closer.. How many times does your loop run?
You can stick it here and put some console.log statements to see it in action
Joseph
@revisualize
Aug 18 2016 02:38
Hi.
Alvin Sutandar
@alvin-ss15
Aug 18 2016 02:39

hello guys... need some help here
stucked on the javascript: Escape Sequences in Strings

var myStr; // Change this line
myStr = "FirstLine\n\\Secondline\\\rThirdLine";

thank you!

somehow it stuck on the ("myStr should have encoded text with the proper escape sequences and no spacing.")
mzedlach
@mzedlach
Aug 18 2016 02:44
@revisualize :wave:
Joseph
@revisualize
Aug 18 2016 02:44
Hello.
@alvin-ss15 Your text isn't correct.
@alvin-ss15 Secondline ... L
Kantra
@removed~kantrakantra
Aug 18 2016 02:45
@Redmega I'm sorry, where should I put the console.log statements to test this
Angel J Piscola
@Redmega
Aug 18 2016 02:46
@kantrakantra No need to apologize. Put it as the first line of the for loop, and have it output i. see what number it goes up to
mzedlach
@mzedlach
Aug 18 2016 02:48

In this:

var andCount = testString.match(expression).length;

What is length for?

Joseph
@revisualize
Aug 18 2016 02:50
@mzedlach To get the length of the .. umm.. thing?
string?
Nelius Knight
@NeliusKnight
Aug 18 2016 02:51
why does the MDN have all these .prototype on the ir documents
eduwin7
@eduwin7
Aug 18 2016 02:51
thanks @itsacoyote
CamperBot
@camperbot
Aug 18 2016 02:51
eduwin7 sends brownie points to @itsacoyote :sparkles: :thumbsup: :sparkles:
:warning: eduwin7 already gave itsacoyote points
kimstopmik
@kimstopmik
Aug 18 2016 02:51
{collection[id][prop] = value; }
why does this work and when using dots it won't?
mzedlach
@mzedlach
Aug 18 2016 02:52
@mzedlach so js needs a string length to know how long to search of a certain word in a sentence (in this case)? It won't just .... search until found or end of string happens?
@revisualize
kimstopmik
@kimstopmik
Aug 18 2016 02:52
function updateRecords(id, prop, value) {if (prop !== "tracks" && value !== "") {collection[id][prop] = value; }
stonefmagiecurata
@stonefmagiecurata
Aug 18 2016 02:52
@NeliusKnight cause everything in js is an object :D
Joseph
@revisualize
Aug 18 2016 02:53
@kimstopmik That's correct for 1 part of the challenge.
@kimstopmik What about the rest?
kimstopmik
@kimstopmik
Aug 18 2016 02:53
@revisualize just started but wondering why it wouldn't work with dot notation
Angel Alcantar
@angel6792001
Aug 18 2016 02:53
Question.
If removing all the nonalphanumeric characters (punctuation, spaces and symbols) from this sentence, isn't it a palindrome?
"1 eye for of 1 eye."
Joseph
@revisualize
Aug 18 2016 02:53
@kimstopmik Dot notation is a string literal.
Kantra
@removed~kantrakantra
Aug 18 2016 02:54
@Redmega Yes I see that it only loops once. Why is that?
Joseph
@revisualize
Aug 18 2016 02:54
@angel6792001 Nope.
Wangchen
@GODWJZ
Aug 18 2016 02:54
Hello guys, I am stuck with a challenge named 'Find the Longest Word in a String'
Here is my code:

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

findLongestWord("The quick brown fox jumped over the lazy dog");

Angel J Piscola
@Redmega
Aug 18 2016 02:54
@kantrakantra Nice. You know what return does? Once the function return's, it stops running ;)
@GODWJZ help format
kimstopmik
@kimstopmik
Aug 18 2016 02:54
@revisualize so it can't handle the id (number) part?
Angel J Piscola
@Redmega
Aug 18 2016 02:54
help format
CamperBot
@camperbot
Aug 18 2016 02:54

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Angel Alcantar
@angel6792001
Aug 18 2016 02:55
@revisualize
Why. I can spell it forwards and backwards the same way?
Joseph
@revisualize
Aug 18 2016 02:55
@kimstopmik myObj.name is the same as myObj["name"] and if "name" is not a property of the object. It wouldn't return.
Ilyes Hammadi
@Ilyes-Hammadi
Aug 18 2016 02:55
@GODWJZ split the string, then loop over it and check the string length, save the value on var
Joseph
@revisualize
Aug 18 2016 02:55
@angel6792001 Spell:
1 eye for of 1 eye
Forward and backward.
@Ilyes-Hammadi No need to split, strings have a .length property
Angel Alcantar
@angel6792001
Aug 18 2016 02:56
@revisualize
eyeforofeye
eyeforofeye
Angel J Piscola
@Redmega
Aug 18 2016 02:56
@angel6792001 Where'd the 1's go?
Wangchen
@GODWJZ
Aug 18 2016 02:57
Thank you ,I will try it
Angel Alcantar
@angel6792001
Aug 18 2016 02:57
@Redmega
I said if you remove all non-alphanumeric characters (punctuation, spaces and symbols)
Angel J Piscola
@Redmega
Aug 18 2016 02:57
@angel6792001 Also, hello fellow Angel :D
Angel Alcantar
@angel6792001
Aug 18 2016 02:57
@Redmega Sup :)
kimstopmik
@kimstopmik
Aug 18 2016 02:57
@revisualize ok, thank you. will try to do the rest and come back here :smile:
CamperBot
@camperbot
Aug 18 2016 02:57
kimstopmik sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1665 | @revisualize |http://www.freecodecamp.com/revisualize
Ilyes Hammadi
@Ilyes-Hammadi
Aug 18 2016 02:57
@Redmega thanks for the tip, i am coming from python background, i am not very into the js world right now lol :smile:
CamperBot
@camperbot
Aug 18 2016 02:57
ilyes-hammadi sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 85 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 02:57
@angel6792001 is a number alphanumeric?
Joseph
@revisualize
Aug 18 2016 02:57
@angel6792001
You're removing the Numeric
1 eye for of 1 eye
eye 1 fo rof eye 1
Angel J Piscola
@Redmega
Aug 18 2016 02:58
@Ilyes-Hammadi Couldnt stand python, tbh... Just personal preference. But python has a len(str) method :P
Angel Alcantar
@angel6792001
Aug 18 2016 02:58
Well, it appears that I removed all my numbers too from my problem.
It's late.
Thank ya @Redmega @revisualize
CamperBot
@camperbot
Aug 18 2016 02:58
angel6792001 sends brownie points to @redmega and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1666 | @revisualize |http://www.freecodecamp.com/revisualize
:cookie: 86 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 02:59
@angel6792001 No worries, I was completing those algorithms yesterday and I ran into the same problem
Joseph
@revisualize
Aug 18 2016 02:59
@angel6792001 You want to keep those.
Angel J Piscola
@Redmega
Aug 18 2016 02:59
The price of coding at 1am
Angel Alcantar
@angel6792001
Aug 18 2016 02:59
@Redmega
No kidding. I've been doing pretty well so far. But my brain power is losing power.
Angel J Piscola
@Redmega
Aug 18 2016 03:00
@angel6792001 When that starts happening, take a break.
Or even... gasp sleep
Ilyes Hammadi
@Ilyes-Hammadi
Aug 18 2016 03:00
@Redmega yeah, and so many useful stuff, my favorite is the setattr() and getattr()
Angel Alcantar
@angel6792001
Aug 18 2016 03:01
@Redmega
Yep. A tip i'm about to embrace.
mzedlach
@mzedlach
Aug 18 2016 03:01
Would anyone suggest a good book to have for learning and for reference for Javascript?
kimstopmik
@kimstopmik
Aug 18 2016 03:01
@revisualize sorry, me again. i still don't completely understand why dot notation doesn't work again while using brackets does.
Angel J Piscola
@Redmega
Aug 18 2016 03:02
@mzedlach I'm attempting to work through this: http://eloquentjavascript.net/
It's great but a bit dense
kimstopmik
@kimstopmik
Aug 18 2016 03:02
else if (prop === "tracks" && value !== "") {

    collection[id][prop].push(value);
  }
Angel J Piscola
@Redmega
Aug 18 2016 03:02
Of course, I'm averse to any and all textbooks, so its understandable
@kimstopmik Are you reffering to the collection.id vs collection[id] issue?
kimstopmik
@kimstopmik
Aug 18 2016 03:03
now, here i would've thought it would work with dot notation
Sabrina Ferguson
@itsacoyote
Aug 18 2016 03:03
@Redmega props to you, that thing takes a dive off the deep end at Ch 6
kimstopmik
@kimstopmik
Aug 18 2016 03:03
@Redmega i think so haha
mzedlach
@mzedlach
Aug 18 2016 03:03
@kimstopmik if you're using variables, you cannot use dot notation. Please correct me if I'm wrong @revisualize
Angel J Piscola
@Redmega
Aug 18 2016 03:04
@mzedlach That's essentially correct
Sabrina Ferguson
@itsacoyote
Aug 18 2016 03:04
@mzedlach like that collection[ id ][ prop ]? I might be wrong
mzedlach
@mzedlach
Aug 18 2016 03:04
@kimstopmik I was hitting my head against a wall on all of this earlier today. @revisualize Can attest to that.
Kantra
@removed~kantrakantra
Aug 18 2016 03:05

@Redmega If I write it like this:

function mutation(arr) {
  var test = arr[1].toLowerCase();
  var target = arr[0].toLowerCase();
  for (i=0;i<test.length;i++){
    if (target.indexOf(test[i]) < 0)
    return false;

  }
  return true;
}

mutation(["hello", "hey"]);

The code works, but I'm not sure I understand why. Why doesn't the 'if' statement need a semicolon after it and why doesn't the instruction 'return false;' need brackets around it? Also why doesn't the 'return true;' statement need to go into an else statement?

kimstopmik
@kimstopmik
Aug 18 2016 03:05
@mzedlach "variable" means "argument" here?
Sabrina Ferguson
@itsacoyote
Aug 18 2016 03:05
oh, totally read that wrong.
mzedlach
@mzedlach
Aug 18 2016 03:05
@kimstopmik ahhh. I'm not sure... My vocabulary is a bit rough. Which lesson are you working on?
mzedlach
@mzedlach
Aug 18 2016 03:06
oh god, this thing.
lol
kimstopmik
@kimstopmik
Aug 18 2016 03:06
that one i understand, but this time i didn't declare any new variable
just using the passed arguments
mzedlach
@mzedlach
Aug 18 2016 03:06
so, yes, using collection[id][prop] is correct
Angel J Piscola
@Redmega
Aug 18 2016 03:07

@kantrakantra 1) If statements don't need semicolons:

if(expression){
     //code
}

2) Why would return false need brackets in your opinion? Where else do you surround expressions with brackets?

3) Because there's no preceding if statement -- THe return is after the for loop. So if the for loop completes without the if statement being true, then it will execute that last return true;

@kantrakantra Oh. By brackets, did you mean braces? Bracket: [] Brace: {}
mzedlach
@mzedlach
Aug 18 2016 03:08
@Redmega Then what is () called?!
Kantra
@removed~kantrakantra
Aug 18 2016 03:08
@Redmega I meant braces {} sorry
kimstopmik
@kimstopmik
Aug 18 2016 03:08
@mzedlach yes, but why? :smile:
Angel J Piscola
@Redmega
Aug 18 2016 03:08
@mzedlach Uhh... Parentheses.....? These are the english names for them, not some fancy programming jargon lol
mzedlach
@mzedlach
Aug 18 2016 03:09
@kimstopmik I mean, what's the alternative? Saying collection.id.prop?
Sabrina Ferguson
@itsacoyote
Aug 18 2016 03:09
them be curly brackets
kimstopmik
@kimstopmik
Aug 18 2016 03:09
@mzedlach yes
Angel J Piscola
@Redmega
Aug 18 2016 03:09
@kantrakantra Expressions don't need braces, braces are basically used to denote blocks of code
kimstopmik
@kimstopmik
Aug 18 2016 03:09
it doesn't work because id and prop are arguments?
@kimstopmik No, thats not why
Kantra
@removed~kantrakantra
Aug 18 2016 03:10
@Redmega I guess essentially what I'm confused about is why 'return false;' isn't run every loop, therefore stopping the loop like before
Angel J Piscola
@Redmega
Aug 18 2016 03:11
@kantrakantra Well, return false will only run if the if condition evaluates to true, right?
What you're basically saying with your code is this: Look at each letter in the second word, check if its in the first word. As soon as you find a letter thats not there, give up and say they dont match
@kimstopmik
var obj = {
name: "bob",
id: "1"
};
obj.name---> "bob"
obj.id ---> "1"
mzedlach
@mzedlach
Aug 18 2016 03:12
@kimstopmik ah! so! I had to go back and re-absorb lessons on this one before I did it too :)
Dot notation is used only when you know the name of a property. Specifically.
[] notation is used if a property has space AND if you're calling on a variable (is it called an argument in this case?). I mean, that thing that represents the input for the function (id,prop,value) that's going to change based on what you input when calling the function.
Angel J Piscola
@Redmega
Aug 18 2016 03:13
Now, if somewhere previous in my code I said var name= 'adam';
And i did obj.bob
I'm still accessing the bob property of the obj.
But if I say obj[bob], because bob evaluates to 123, its like I'm saying obj['123'], and I'll get undefined
I could have used more concise variable names...
kimstopmik
@kimstopmik
Aug 18 2016 03:15
Hmmmm.
mzedlach
@mzedlach
Aug 18 2016 03:15

@kimstopmik So


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

myMusic.artist NOT myMusic[artist]
BUT
myMusic["release year"] NOT myMusic."release year"

Kantra
@removed~kantrakantra
Aug 18 2016 03:15
@Redmega Ok this is somewhat confusing. So you're saying for loops don't complete every instruction inside their respective braces? It only completes until the first false statement?
Angel J Piscola
@Redmega
Aug 18 2016 03:16
@kantrakantra Lets dissect your code in private chat
Kantra
@removed~kantrakantra
Aug 18 2016 03:16
@Redmega ok that would be helpful
mzedlach
@mzedlach
Aug 18 2016 03:16
@kimstopmik and then if you have arguments, it will always be in []
kimstopmik
@kimstopmik
Aug 18 2016 03:16
myMusic.artist would give "Billy Joel" out, right?
Kantra
@removed~kantrakantra
Aug 18 2016 03:16
@Redmega what does one use for private chat on fcc?
kimstopmik
@kimstopmik
Aug 18 2016 03:17
and myMusic[artist] would give "Billy Joel" out or not?
Angel J Piscola
@Redmega
Aug 18 2016 03:17
You should be able to click on my picture and hit "chat privately" @kantrakantra
kimstopmik
@kimstopmik
Aug 18 2016 03:17
and thanks @Redmega , trying to understand :smile:
CamperBot
@camperbot
Aug 18 2016 03:17
kimstopmik sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 87 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 03:17
Or click on the person icon on the left and click on my name, you should have recieved some messages from me already
mzedlach
@mzedlach
Aug 18 2016 03:17
@kimstopmik "myMusic.artist would give "Billy Joel" out, right?" Yes
But for the second one, I think it would have to be myMusic["artist"]
again, someone correct me if i'm wrong.
Jamala Blake
@jtblake27
Aug 18 2016 03:18
Hey, I need help with bracket notation.
my code is
kimstopmik
@kimstopmik
Aug 18 2016 03:18
hmm
Kantra
@removed~kantrakantra
Aug 18 2016 03:18
@Redmega I'm not seeing that feature. Can you msg me?
kimstopmik
@kimstopmik
Aug 18 2016 03:18
i will just try it out now :smile:
ZZPot
@ZZPot
Aug 18 2016 03:18
how to call methods of object from constructor?
Angel J Piscola
@Redmega
Aug 18 2016 03:18
Pay attention to the use of quotation marks to denote string literals vs object properties
kimstopmik
@kimstopmik
Aug 18 2016 03:19
yes, i have been on that page before but i think it doesn't say what I'm interested in. looking again, thanks.
mzedlach
@mzedlach
Aug 18 2016 03:20
@kimstopmik From my notes, I just wrote....
dot --> You know the exact name of the property.
[] -->You know the exact name BUT it has spaces, so you need to do ["blah blah"]. OR, you want to call on an argument.
kimstopmik
@kimstopmik
Aug 18 2016 03:20
is it maybe that obj.prop does give me the value back? instead of referring to the key property itself
resnad
@resnad
Aug 18 2016 03:20
Why is this wrong? var myStr = "I am a \"double quoted"\ string inside \"double quotes".";
kimstopmik
@kimstopmik
Aug 18 2016 03:21
@resnad there's missing a \ in the end ?
mzedlach
@mzedlach
Aug 18 2016 03:21
@kimstopmik If there was a property in obj that was called prop, you would get somethign back. But since there is no "prop" to find, it will return nothing.
kimstopmik
@kimstopmik
Aug 18 2016 03:21
also the \ has to be before the "
resnad
@resnad
Aug 18 2016 03:21
Lol wat. I have that backslash in my code
Weird
Thanks Kim
kimstopmik
@kimstopmik
Aug 18 2016 03:21
"I am a \"double quoted\" string inside \"double quotes\"."
like this i think
Chad Powell
@cjpowellaz
Aug 18 2016 03:22
When working on the Javascript challenges, when reading I notice that some methods are named with "prototype". example: string.prototype.repeat(). What does the prototype mean?
mzedlach
@mzedlach
Aug 18 2016 03:22
@kimstopmik Was that helpful in any way? hahah :)
kimstopmik
@kimstopmik
Aug 18 2016 03:22
@mzedlach yes, everything helpful :smile:
i am still thinking though
now reading up on MDN
mzedlach
@mzedlach
Aug 18 2016 03:23
okay :)
What's MDN?
mzedlach
@mzedlach
Aug 18 2016 03:23
ahh. Yes.
kimstopmik
@kimstopmik
Aug 18 2016 03:23
the name is just too long to write :shipit:
mzedlach
@mzedlach
Aug 18 2016 03:24
@Redmega the book chat got burried! What are your thoughts on that book so far? Dense is good. I would like to get a book that has much more than less.
Angel J Piscola
@Redmega
Aug 18 2016 03:24
@mzedlach Dense as in ability to successfully transfer knowledge into my brain, not dense as in quantity of stuff per volume ;)
Used in a sentence... "That book is so dense, I get a headache from the first paragraph"
mzedlach
@mzedlach
Aug 18 2016 03:25
@Redmega hahaah, okay :)
Angel J Piscola
@Redmega
Aug 18 2016 03:27
Yeah
But it does have a lot of good information in it
And good practices too
pahosler
@pahosler
Aug 18 2016 03:27
I was playing around to night, if anyone is interested in using sprite sheets in javascript, I made this little test... http://codepen.io/pahosler/pen/ZOPXJj?editors=0110
ZZPot
@ZZPot
Aug 18 2016 03:27
how to call methods of object from constructor?
Angel J Piscola
@Redmega
Aug 18 2016 03:28
@ZZPot Context?
mzedlach
@mzedlach
Aug 18 2016 03:28
Holy guacamole.... I finally finished Basic js. Now I can go to bed.
@Redmega I will definitely look into it :)
Angel J Piscola
@Redmega
Aug 18 2016 03:28
:clap:
ZZPot
@ZZPot
Aug 18 2016 03:29
@Redmega фрб Ш вшв ше ьныудаю ершыю тщефешщт зкщидуьы
Angel J Piscola
@Redmega
Aug 18 2016 03:29
@ZZPot Sorry mate, don't speak whatever that is
ZZPot
@ZZPot
Aug 18 2016 03:29
@Redmega solved
Angel J Piscola
@Redmega
Aug 18 2016 03:29
@ZZPot Well thats good :ok_hand:
mzedlach
@mzedlach
Aug 18 2016 03:30
Russian?
belarusian?
Kantra
@removed~kantrakantra
Aug 18 2016 03:30
@Redmega thank you
CamperBot
@camperbot
Aug 18 2016 03:30
kantrakantra sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 88 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Aug 18 2016 03:30
:D
mzedlach
@mzedlach
Aug 18 2016 03:31
Bulgarian!!
Angel J Piscola
@Redmega
Aug 18 2016 03:31
Google says bul-
Yeah
mzedlach
@mzedlach
Aug 18 2016 03:32
Yeah, Google translate failed.
That is so disappointing! :(
How could they consider translation only romanization? That seems odd.
Alright, goodnight everyone! Happy coding!
pahosler
@pahosler
Aug 18 2016 03:33
google translate said... ah, I did it myself.
Angel J Piscola
@Redmega
Aug 18 2016 03:37
GOogle didnt translate it for me, but when I did a search for it it autocorrected it to english...
kimstopmik
@kimstopmik
Aug 18 2016 04:03
hm
still doing the collection thing:
now, it says TypeError: Cannot read property push of undefined.
referring to this: collection[id][prop].push(value);
Joseph
@revisualize
Aug 18 2016 04:06
I am home!
@kimstopmik You're trying to either push to something that doesn't exist. Or you're trying to push to a string.
Angel J Piscola
@Redmega
Aug 18 2016 04:07
Nah, of undefined
Joseph
@revisualize
Aug 18 2016 04:07
@kimstopmik What is your function? Please just the function. We do NOT need to see that long object.
Angel J Piscola
@Redmega
Aug 18 2016 04:07
@kimstopmik collection[id][prop] is undefined
Joseph
@revisualize
Aug 18 2016 04:07
So, you're trying to push to something that doesn't exist.
Angel J Piscola
@Redmega
Aug 18 2016 04:08
@revisualize If it was a string it would've said push is not a function
Or something to that affect
Joseph
@revisualize
Aug 18 2016 04:09
Yeah yeah. I was just glancing. And guessing. It happens a lot. People don't make the tracks array for the element that doesn't exist.
kimstopmik
@kimstopmik
Aug 18 2016 04:10
code looking a bit messy now, trying around here all time :smile:
wuyuan1992
@wuyuan1992
Aug 18 2016 04:10
Please help me to find out why this return "-1" instead of expected "2".
kimstopmik
@kimstopmik
Aug 18 2016 04:10
function updateRecords(id, prop, value) {


  if (prop !== "tracks" && value !== "") {

    collection[id][prop] = value;

  }

  else if (prop === "tracks" && collection[id][prop] === "undefined") {

    collection[id][prop] = [];

    if(value !== "") {

      collection[id][prop].push(value);

    }

  }

  else if (prop === "tracks" && value !== "") {

    if(collection[id][prop] === "undefined"){

      collection[id][prop] = [];
    }

     collection[id][prop].push(value);

  }

  else if (value === "") {

    delete collection[id][prop];

  }

  return collection;
}
wuyuan1992
@wuyuan1992
Aug 18 2016 04:10

function getIndexToIns(arr, num) {
// Find my place in this sorted array.
arr.push(num);
arr.sort(function(a,b){
return a-b;
});
var Newarr = arr.filter(function(val){
return val !== arr[arr.indexOf(val)+1];
});
return Newarr.indexOf(num);
}

getIndexToIns([10, 20, 30, 40, 50], 30);

kimstopmik
@kimstopmik
Aug 18 2016 04:11
the weird thing is that it had worked when the array didn't exist
but not when the array existed
now i messed it up a bit too much i think :smile:
Nelius Knight
@NeliusKnight
Aug 18 2016 04:11
in the MDN, what is the .prototype supposed to be meaning or covering?
kimstopmik
@kimstopmik
Aug 18 2016 04:11
it was just the "After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element." part which wasnt fulfilled at some point :smile:
Angel J Piscola
@Redmega
Aug 18 2016 04:12
help format
CamperBot
@camperbot
Aug 18 2016 04:12

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Angel J Piscola
@Redmega
Aug 18 2016 04:13
@NeliusKnight prototype is like a blueprint for what an object should have
Saying String.prototype.length means that every String instance will have a property called length
kimstopmik
@kimstopmik
Aug 18 2016 04:13
I really don't understand why the object/property should be undefined there when it works in the other parts of the function
Nelius Knight
@NeliusKnight
Aug 18 2016 04:14
@Redmega so really. it could just be string.Length couldn't it?
.length
Angel J Piscola
@Redmega
Aug 18 2016 04:14
no because String is a specific object
Rather, the class
Nelius Knight
@NeliusKnight
Aug 18 2016 04:15
so if you were putting something over prototype, what would i tbe?
it*
Angel J Piscola
@Redmega
Aug 18 2016 04:15
You could add a method to all strings to capitalize it
Pogg
@fogkio
Aug 18 2016 04:15
i need help
Angel J Piscola
@Redmega
Aug 18 2016 04:15
String.prototype.capitalize = function(){this.firstcharacter.touppercase} ((Just pseudocode))
Now you can call"world".capitalize(); and it would give you World
Nelius Knight
@NeliusKnight
Aug 18 2016 04:16
and the output would become what? on your pseudocode
Ok right there, so "world" is what could be replacing .prototype?
Angel J Piscola
@Redmega
Aug 18 2016 04:16
No, world is just a string literal
Nelius Knight
@NeliusKnight
Aug 18 2016 04:17
cause i dont see everyone using a bunch of code with .prototype in it. lol. idk why this is confusing me this much.
Angel J Piscola
@Redmega
Aug 18 2016 04:17
var x = "hello";
return x.capitalize();
returns "Hello"
Nelius Knight
@NeliusKnight
Aug 18 2016 04:17
i feel like its a placeholder or something
Angel J Piscola
@Redmega
Aug 18 2016 04:17
It is, sort of
When you make a change to the prototype that change affects all instances of that Type
Nelius Knight
@NeliusKnight
Aug 18 2016 04:18
so x would be the prototype?
Angel J Piscola
@Redmega
Aug 18 2016 04:18
No, in that case x is just a var..
Pogg
@fogkio
Aug 18 2016 04:18
how can i make Escape Sequences in Strings work :( i stuck in this solve
Angel J Piscola
@Redmega
Aug 18 2016 04:18
@NeliusKnight Do you have background in a strongly typed language like Java or C?
Nelius Knight
@NeliusKnight
Aug 18 2016 04:19
gotcha. i should go check javascript basics again lol @Redmega thanks though, and i do not. i'm literally just getting into coding still, starting with what is being taught here
CamperBot
@camperbot
Aug 18 2016 04:19
neliusknight sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 89 | @redmega |http://www.freecodecamp.com/redmega
Nelius Knight
@NeliusKnight
Aug 18 2016 04:20
I was reading out documents and seeing all the .prototype is throwing me off a bit.
Angel J Piscola
@Redmega
Aug 18 2016 04:20
@NeliusKnight Ok, cool. Just think of prototype as the blueprint. So if on the MDN you see something like Array.prototype.sort(), you know that any array you have will have the function called sort() that you can call on it
In the mean time you can ignore the prototype in the source docs and just know that it means objects of the Type declared (example: Array)
Nelius Knight
@NeliusKnight
Aug 18 2016 04:22
ok here is where i might under stand
kimstopmik
@kimstopmik
Aug 18 2016 04:22
so
Nelius Knight
@NeliusKnight
Aug 18 2016 04:22
lets say
```
kimstopmik
@kimstopmik
Aug 18 2016 04:23
  else if (prop === "tracks" && value !== "") {

    if(collection[id][prop] === "undefined"){

      collection[id][prop] = [];
    }

     collection[id][prop].push(value);

  }
it's about this part as it seems from the chrome console thing
but don't i just create the array there before using .push()?
so why is it undefined then
Nelius Knight
@NeliusKnight
Aug 18 2016 04:24
let say i write this, right? now if this was in the MDN, is the "Hello" part normally where the MDN would place the .prototype as the placeholder?
console.log("Hello".startsWith("H")); // true
Angel J Piscola
@Redmega
Aug 18 2016 04:24
No
Hmm
Joseph
@revisualize
Aug 18 2016 04:25
@kimstopmik Your if condition is incorrect.
@kimstopmik How do you test if an object has a property?
Angel J Piscola
@Redmega
Aug 18 2016 04:25
String.prototype.startsWith() is saying that in my String.prototype I have a function called startsWith
So looking at that I know that I can call .startsWith() from any string object
Nelius Knight
@NeliusKnight
Aug 18 2016 04:26
OOOOOOOOOOOOH
kimstopmik
@kimstopmik
Aug 18 2016 04:26
@revisualize that hasOwnProperty something?
Angel J Piscola
@Redmega
Aug 18 2016 04:26
"Hello" is a string object
So i can call .startsWith() on it
Did it click?
Nelius Knight
@NeliusKnight
Aug 18 2016 04:26
thank you thank you thank you thank you
Angel J Piscola
@Redmega
Aug 18 2016 04:26
Haha :)
Nelius Knight
@NeliusKnight
Aug 18 2016 04:26
@Redmega thank you x10000000000000000000000000
CamperBot
@camperbot
Aug 18 2016 04:26
neliusknight sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:warning: neliusknight already gave redmega points
Angel J Piscola
@Redmega
Aug 18 2016 04:26
Lol
Joseph
@revisualize
Aug 18 2016 04:27
@kimstopmik Great! ... Why aren't you using it?
Nelius Knight
@NeliusKnight
Aug 18 2016 04:27
you're amazing Angel!
Angel J Piscola
@Redmega
Aug 18 2016 04:27
all prototype is is a blueprint of what object has what
Oh please
Lol
Nelius Knight
@NeliusKnight
Aug 18 2016 04:27
If I become a great programmer since im not giving up, its all going to be thanks to you! ^.^
kimstopmik
@kimstopmik
Aug 18 2016 04:27
@revisualize I don't know :smile:
Angel J Piscola
@Redmega
Aug 18 2016 04:29
@NeliusKnight That's quite an honor, I don't know what to say except thank you.. xD
CamperBot
@camperbot
Aug 18 2016 04:29
redmega sends brownie points to @neliusknight :sparkles: :thumbsup: :sparkles:
:cookie: 51 | @neliusknight |http://www.freecodecamp.com/neliusknight
Nelius Knight
@NeliusKnight
Aug 18 2016 04:29
how long have you been a programmer for?
kimstopmik
@kimstopmik
Aug 18 2016 04:30
if(!collection.hasOwnProperty("tracks"))
like this? @revisualize
Joseph
@revisualize
Aug 18 2016 04:30
@kimstopmik Sure?
Does it work?
Angel J Piscola
@Redmega
Aug 18 2016 04:31
@NeliusKnight I've been programming professionally since July of last year. Before that I was in school and took maybe 3 compsci classes total.
I'm wrapping up my BS-IST this coming Spring
@ndburrus Thanks for the links :D
CamperBot
@camperbot
Aug 18 2016 04:31
redmega sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1658 | @ndburrus |http://www.freecodecamp.com/ndburrus
Joseph
@revisualize
Aug 18 2016 04:32
@kimstopmik If it doesn't complete.. What's the rest of your function? (Just the function we do not need nor do we want to see that large object.)
kimstopmik
@kimstopmik
Aug 18 2016 04:32
ah
Norvin Burrus
@ndburrus
Aug 18 2016 04:32
@Redmega you're welcome! enjoy! :palm_tree:
kimstopmik
@kimstopmik
Aug 18 2016 04:32
if(!collection[id].hasOwnProperty("tracks"))
it was missing the [id] part now :smile:
now it's completed
Joseph
@revisualize
Aug 18 2016 04:32
:)
Nelius Knight
@NeliusKnight
Aug 18 2016 04:33
@ndburrus yes thanks for the links! reading them all now just to make sure it sticks! and @Redmega, Nice! have you had many times where something you didn't understand just finally clicked out of nowhere?
CamperBot
@camperbot
Aug 18 2016 04:33
neliusknight sends brownie points to @ndburrus and @redmega :sparkles: :thumbsup: :sparkles:
:warning: neliusknight already gave redmega points
:star2: 1659 | @ndburrus |http://www.freecodecamp.com/ndburrus
kimstopmik
@kimstopmik
Aug 18 2016 04:33
thanky you @revisualize
CamperBot
@camperbot
Aug 18 2016 04:33
kimstopmik sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1668 | @revisualize |http://www.freecodecamp.com/revisualize
Angel J Piscola
@Redmega
Aug 18 2016 04:33
@NeliusKnight Basically every day is like that ;)
kimstopmik
@kimstopmik
Aug 18 2016 04:33
and thanks for the help before @Redmega
CamperBot
@camperbot
Aug 18 2016 04:33
kimstopmik sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 90 | @redmega |http://www.freecodecamp.com/redmega
Norvin Burrus
@ndburrus
Aug 18 2016 04:33
@NeliusKnight you're welcome! sounds great! :+1:
Angel J Piscola
@Redmega
Aug 18 2016 04:33
@kimstopmik Sure :)
Nelius Knight
@NeliusKnight
Aug 18 2016 04:33
ah! @Redmega ok good, almost thought I was alone on that boat!
Joseph
@revisualize
Aug 18 2016 04:34
Ack! That guy from Motor City is going to pass me brownie point number!
kimstopmik
@kimstopmik
Aug 18 2016 04:34
finally finished with this :smile: by far the hardest one til now of all the challenges
Angel J Piscola
@Redmega
Aug 18 2016 04:34
info @revisualize
Joseph
@revisualize
Aug 18 2016 04:34
@kimstopmik Oh you just wait!
Angel J Piscola
@Redmega
Aug 18 2016 04:34
Hmm
How do you get the gitter bot to tell you peoples brownie points?
Nelius Knight
@NeliusKnight
Aug 18 2016 04:34
when we use the [ ] brackets, are those always going to be arrays?
Joseph
@revisualize
Aug 18 2016 04:34
@kimstopmik Soon... You'll be bashing your face against the keyboard and think that Record Collection was easy.
@Redmega about
Angel J Piscola
@Redmega
Aug 18 2016 04:35
about @revisualize
CamperBot
@camperbot
Aug 18 2016 04:35
:star2: 1668 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Aug 18 2016 04:35
Stalker.
Angel J Piscola
@Redmega
Aug 18 2016 04:35
:thumbsup:
:hear_no_evil:
kimstopmik
@kimstopmik
Aug 18 2016 04:35
@revisualize :smile: the harder the better, i don't like it when it's more of a typing than a thinking job
Angel J Piscola
@Redmega
Aug 18 2016 04:35
Fyi, great books for coding on the humble bundle right now: https://www.humblebundle.com/books/joy-of-coding-book-bundle
Joseph
@revisualize
Aug 18 2016 04:37
@Redmega Hmm.. $15.. Not a bad deal.
@Redmega The problem that I have is even if I spent 15.00 I don't even know if I'd get around to reading 1 of those books.
You know what.. Screw it. I'll pay the bundle.
Angel J Piscola
@Redmega
Aug 18 2016 04:43
Yeah
Worst case scenario, you gave $15 to charity
I know I wont read the clojure, R, python, lisp, racket, haskell, erlang, F#...
The majority of the books
lol
I got it for a friend actually, he just got hired at my job but hes struggling a bit
I'm hoping the Think Like a Programmer: An Introduction to Creative Problem Solving can help him
Cindy
@qdkueh
Aug 18 2016 04:48

function destroyer(arr) {
// Remove all the values
function whatwewant(value) {
for (var i=1; i<arr.length; i++) {

}

return value;

}
var filtered = arr.filter(whatwewant);
// filtered is [12, 130, 44]

return filtered;
}

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

pls help
Joseph
@revisualize
Aug 18 2016 04:48
I gave 11.00 to charity. 3.00 to the publisher and 1.00 to the company.
Angel J Piscola
@Redmega
Aug 18 2016 04:48
help format
CamperBot
@camperbot
Aug 18 2016 04:48

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Markus Kiili
@Masd925
Aug 18 2016 04:49
@qdkueh You need to use the arguments object. The only parameter arr only catches the first passed argument [1, 2, 3, 1, 2, 3]
Cindy
@qdkueh
Aug 18 2016 04:49
i dont understand
lol
Markus Kiili
@Masd925
Aug 18 2016 04:50
@qdkueh Filter iterates arr and makes a new array from the filtered elements, so you don't need to loop arr elements.
You need to loop the arguments though. Probably inside the filter callback function.
Cindy
@qdkueh
Aug 18 2016 04:50
ok..
loop the arguments inside..
then the return would be how?
it can return one value only right?
R.Ganesh
@ganes1410
Aug 18 2016 04:52
function confirmEnding(str, target) {
var n=str.length;
  if(str.substring(n-1)===target)
    return true;
  else 

  return false;
}

confirmEnding("Bastian", "n");
what's wrong with this?
Markus Kiili
@Masd925
Aug 18 2016 04:52
@qdkueh First you need to understand how filter method works. Look at some simple examples on MDN or some other source.
Angel J Piscola
@Redmega
Aug 18 2016 04:54
@ganes1410 What issue are you having? It seems to work for me
R.Ganesh
@ganes1410
Aug 18 2016 04:55
blob
@Redmega
王自强
@Kingziqiang
Aug 18 2016 04:55
Angel J Piscola
@Redmega
Aug 18 2016 04:56
@ganes1410 Oh, whoops. It asks you to confirm the entire ending, not just the last character
@ganes1410 You're comparing "same" to "s"
Markus Kiili
@Masd925
Aug 18 2016 04:57
@ganes1410 You need to cut the end part of str that has the length of target, so target.length needs to be used there.
Cindy
@qdkueh
Aug 18 2016 04:57
@Masd925 i dun understand what the mdn saysssss O____O
John Ngo
@johnngo
Aug 18 2016 04:58

Assign the following three lines of text into the single variable myStr using escape sequences.

FirstLine
\SecondLine\
ThirdLine

any suggests?
Markus Kiili
@Masd925
Aug 18 2016 04:58
@qdkueh Post one filter example here and we can go through it.
Joseph
@revisualize
Aug 18 2016 04:58
What is the preferred E-book method? .PDF, .epub or .mobi
R.Ganesh
@ganes1410
Aug 18 2016 04:58
@Masd925 i don't understand
Cindy
@qdkueh
Aug 18 2016 04:59
@Masd925 function isBigEnough(value) {
return value >= 10;
}
var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
// filtered is [12, 130, 44]
@Masd925
function isBigEnough(value) { return value >= 10; } var filtered = [12, 5, 8, 130, 44].filter(isBigEnough); // filtered is [12, 130, 44]
Angel J Piscola
@Redmega
Aug 18 2016 04:59
@revisualize It's almost completely dependent on which ebook you own
Err... e-reader...
Joseph
@revisualize
Aug 18 2016 04:59
None.
So, I guess. PDF?
Markus Kiili
@Masd925
Aug 18 2016 05:00
@ganes1410 You need to make a substring from the end part of str, that has the same length as target, and compare it to target.
Angel J Piscola
@Redmega
Aug 18 2016 05:00
If its gonna be on your computer, PDF
Jason Keenan
@raavin
Aug 18 2016 05:00
I'd go ePub myself
Angel J Piscola
@Redmega
Aug 18 2016 05:00
If you plan on loading it onto a kindle or nook or something, then you'd consider another format
Jason Keenan
@raavin
Aug 18 2016 05:01
For ereader anyway. Just do all of them
Angel J Piscola
@Redmega
Aug 18 2016 05:01
I mean, you have the purchase tied to your email @revisualize so its not like you can't re-download them later
Cindy
@qdkueh
Aug 18 2016 05:01
@Masd925
@Masd925
'''js function isBigEnough(value) {
return value >= 10;
}
var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
// filtered is [12, 130, 44]'''
CamperBot
@camperbot
Aug 18 2016 05:02
:bulb: to format code use backticks! ``` more info
Joseph
@revisualize
Aug 18 2016 05:02
@Redmega I also have 8TB of storage available.
Cindy
@qdkueh
Aug 18 2016 05:04
help
CamperBot
@camperbot
Aug 18 2016 05:04

CamperBot

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

  • find TOPIC find all entries about topic. e.g. find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • Algorithm BONFIRENAME info on a Algorithm

meet CamperBot in FreeCodeCamp/camperbotPlayground

:pencil: read more about camperbot on the FCC Wiki

Joseph
@revisualize
Aug 18 2016 05:04
@qdkueh You do realize that isBigEnough is a function that takes a value?
Cindy
@qdkueh
Aug 18 2016 05:05
ya
thats just an example of filter
let me post the question that im stuck on
@revisualize
function destroyer(arr) {
  // Remove all the values
  function whatwewant(value) {
    for (i=1; i<arr.length; i++) {

    }
  }

  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Joseph
@revisualize
Aug 18 2016 05:05
OH THAT!
Yeah... .... look at ... the ... time.
Cindy
@qdkueh
Aug 18 2016 05:06
the filter question
Joseph
@revisualize
Aug 18 2016 05:06
:v:
Cindy
@qdkueh
Aug 18 2016 05:06
@_@
pls help
Stefan Bekirov
@bekir0v
Aug 18 2016 05:08

hey
what is wrong on my code
```var Car = function() {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};

//Try it out here
var myCar = new Car(6, 3, 1);
```

Markus Kiili
@Masd925
Aug 18 2016 05:08
@qdkueh Yes, let's go through the example.
Cindy
@qdkueh
Aug 18 2016 05:09
ya
i get it when it has just one value
i dont understand how to make it filter 2 values
Markus Kiili
@Masd925
Aug 18 2016 05:09
@qdkueh You have an array of numbers and you pass a function to filter method.
@qdkueh Filter automatically iterates through the array and passes each array element to the function you provide and keeps those that return true.
John Ngo
@johnngo
Aug 18 2016 05:11
var myStr= "FirstLine\n\SecondLine\r\ThirdLine";
Cindy
@qdkueh
Aug 18 2016 05:11
they always take the first array in the array only?
John Ngo
@johnngo
Aug 18 2016 05:11
can't seem to complete this task

Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

Cindy
@qdkueh
Aug 18 2016 05:13
@Masd925 how do i pass the 2 and 3 to the loop?
sean9
@sean9
Aug 18 2016 05:13
Holy cow why am i having so much trouble with escape methods?
Joseph
@revisualize
Aug 18 2016 05:13

var myStr= "FirstLine\n\SecondLine\r\ThirdLine";

@johnngo You're not escaping the \ correctly.

sean9
@sean9
Aug 18 2016 05:13
var myStr = "FirstLine\n \SecondLine\ \rThirdLine";
Joseph
@revisualize
Aug 18 2016 05:14
FirstLinenewline backslash SecondLine backslash carriage-returnThirdLine
sean9
@sean9
Aug 18 2016 05:14
whoops how do i input code clips again?
Joseph
@revisualize
Aug 18 2016 05:14
Damn.
John Ngo
@johnngo
Aug 18 2016 05:14
thanks guys - var myStr= "FirstLine\n\SecondLine\\rThirdLine";
it passed, missing backslash
Joseph
@revisualize
Aug 18 2016 05:15
@johnngo :)
Angel J Piscola
@Redmega
Aug 18 2016 05:15
@johnngo :clap:
sean9
@sean9
Aug 18 2016 05:15
how do i input code?
so it displays properly on ehre
here
Angel J Piscola
@Redmega
Aug 18 2016 05:16
help format
CamperBot
@camperbot
Aug 18 2016 05:16

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Joseph
@revisualize
Aug 18 2016 05:16
So, I just dropped into a challenge.
Title Case a Sentence Completed: Nov 28, 2015
And was all.. How can I do this as ES6. One line of code and I just wrote it out. Without any errors.
sean9
@sean9
Aug 18 2016 05:16
var myStr = "FirstLine\n\\SecondLine\\\rThirdLine";
Angel J Piscola
@Redmega
Aug 18 2016 05:16
@revisualize :clap:
Lemme see
sean9
@sean9
Aug 18 2016 05:16
what am i dont doing right here
Joseph
@revisualize
Aug 18 2016 05:17
@Redmega The before and after?
Angel J Piscola
@Redmega
Aug 18 2016 05:17
@revisualize Sure. Mine is messy.
/* jshint esversion:6 */

function titleCase(str) {
  return str.toLowerCase().split(' ').map((x) => {let y=x.split('');y[0]=y[0].toUpperCase();return y.join('');}).join(' ');
}
Andrew Kay
@andrewjkay
Aug 18 2016 05:17
This message was deleted
Angel J Piscola
@Redmega
Aug 18 2016 05:17
I did it last night at around 1am, so I'm sure theres ways to make it more efficient
Markus Kiili
@Masd925
Aug 18 2016 05:17
@qdkueh Are you talking about the example or the FCC challenge?
Cindy
@qdkueh
Aug 18 2016 05:18
@Masd925 the challenge
Joseph
@revisualize
Aug 18 2016 05:18
@Redmega
const titleCase = str => str.split(" ").map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");

/*
function titleCase(str) {
  stringArray = str.toLowerCase().split(" ");
  for (var i = 0; i < stringArray.length; i++) {
      stringArray[i] = stringArray[i].charAt(0).toUpperCase() + stringArray[i].slice(1);
    }
  return stringArray.join(" ");
}
*/
Markus Kiili
@Masd925
Aug 18 2016 05:18
@qdkueh You need to use the arguments object that has all the passed arguments. You need to read on that too.
Joseph
@revisualize
Aug 18 2016 05:18
@Redmega The before is the comment. That's what I wrote when I was learning JS.
Angel J Piscola
@Redmega
Aug 18 2016 05:19
@revisualize Woah, how long ago was that?
Joseph
@revisualize
Aug 18 2016 05:20
@Redmega Well, I first completed that challenge on Nov 28, 2015
Angel J Piscola
@Redmega
Aug 18 2016 05:20
I still have trouble with encapsulation and knowing when to omit characters
@revisualize One year later... :cake:
Joseph
@revisualize
Aug 18 2016 05:21
DAMN! 1 year!
I suck!
ACK!
Angel J Piscola
@Redmega
Aug 18 2016 05:21
Well, almost
Joseph
@revisualize
Aug 18 2016 05:21
I need to finish this shit!
Angel J Piscola
@Redmega
Aug 18 2016 05:21
I'd say you came hella far since then
Wait, do you not have your front-end cert?
Joseph
@revisualize
Aug 18 2016 05:21
NO!
Angel J Piscola
@Redmega
Aug 18 2016 05:21
YES! I'M NOT THE ONLY PROCRASTINATOR!
Joseph
@revisualize
Aug 18 2016 05:21
I joined FCC Nov 19, 2015
Angel J Piscola
@Redmega
Aug 18 2016 05:22
I joined some time this April
Yep, APril 11
Joseph
@revisualize
Aug 18 2016 05:22
Wow.. I really need to get on this stuff and finish.
Though, I read that IT hiring is slowing currently. So, there's that.
Angel J Piscola
@Redmega
Aug 18 2016 05:23
Same.. I'm working on my portfolio right now
I have an old one online, I'm almost embarrassed to link it. http://angelpiscola.xyz
That was back in... Hmm.. I'd say february
Theres always a need for front-end guys
Joseph
@revisualize
Aug 18 2016 05:25
I'm going to have to double time my :ship:
I've been debating just quitting my job. And going full time learning on my own for 3 months.
kimstopmik
@kimstopmik
Aug 18 2016 05:26
sounds great if you can afford to :+1:
Angel J Piscola
@Redmega
Aug 18 2016 05:27
It does, but I'd be cautious
Joseph
@revisualize
Aug 18 2016 05:27
I could be unemployed for 6 months. Of course. If I didn't get a job. Well, I'd be screwed.
Angel J Piscola
@Redmega
Aug 18 2016 05:27
Depending on where you live it might be better to stay with your current job
Yeah, exactly
Joseph
@revisualize
Aug 18 2016 05:27
6 months and 1 day without a check in sight. And .. I'm done.
Angel J Piscola
@Redmega
Aug 18 2016 05:27
I'm lucky in that I started early. In college I was in an internship with http://yearup.org and they placed me at a company for 6 months
After that the company hired me
My salary is pretty damn low but I'm delivering a lot more than my level so I'm hoping for a promotion by the end of the year
Of course, I say pretty damn low, but its a lot more than minimum wage.
kimstopmik
@kimstopmik
Aug 18 2016 05:29
is there minimum wage in America?
Angel J Piscola
@Redmega
Aug 18 2016 05:30
$7.25
kimstopmik
@kimstopmik
Aug 18 2016 05:30
for every job?
Angel J Piscola
@Redmega
Aug 18 2016 05:30
Most
kimstopmik
@kimstopmik
Aug 18 2016 05:30
i didn't know
Angel J Piscola
@Redmega
Aug 18 2016 05:30
Some get around it
Waiters and waitresses are often paid no more than $3 to $4 an hour, and the tips are expected to make up for the difference
Tip culture is horrible in the US... But thats a whole nother bucket of worms, and pretty off topic for this chat ;)
kimstopmik
@kimstopmik
Aug 18 2016 05:31
something you don't get to know in europe :smile: talking about the cruel capitalist Americans :smile:
yes, sorry but i had to get to know this now :shipit:
Chris Cullen
@123xylem
Aug 18 2016 05:32
How do i make a number react to time in java script eg. time =500... every second time --
?
Angel J Piscola
@Redmega
Aug 18 2016 05:32
@123xylem context?
Chris Cullen
@123xylem
Aug 18 2016 05:33
var time=500
for every second
time --
.onClick
Angel J Piscola
@Redmega
Aug 18 2016 05:33
help setInterval
CamperBot
@camperbot
Aug 18 2016 05:33
no wiki entry for: setinterval
Angel J Piscola
@Redmega
Aug 18 2016 05:33
hmm
Chris Cullen
@123xylem
Aug 18 2016 05:33
help setInterval
CamperBot
@camperbot
Aug 18 2016 05:33
no wiki entry for: setinterval
Cindy
@qdkueh
Aug 18 2016 05:34

@Masd925 ```js
function destroyer(arr) {
// Remove all the values
function whatwewant(value) {
for (i=1; i<arguments.length; i++) {
return value !== arguments[i];
}
}
var filtered = arr.filter(whatwewant);
return filtered;
}

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

lazy_bunny
@lazyCoder036
Aug 18 2016 05:34
hi
Joseph
@revisualize
Aug 18 2016 05:34
@Redmega I just read your post. Wow. That's a lot of code.
lazy_bunny
@lazyCoder036
Aug 18 2016 05:34
of topic help required
Joseph
@revisualize
Aug 18 2016 05:34
@lazyCoder036 hi.
Cindy
@qdkueh
Aug 18 2016 05:34
@Masd925 , whats wrong with this one...
function destroyer(arr) {
  // Remove all the values
  function whatwewant(value) {
    for (i=1; i<arguments.length; i++) {
      return value !== arguments[i];
    }
  }
var filtered = arr.filter(whatwewant);
return filtered;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
lazy_bunny
@lazyCoder036
Aug 18 2016 05:34
can any one suggest me a good free text editor
Markus Kiili
@Masd925
Aug 18 2016 05:34
@qdkueh The filter callback function has its own arguments object.
Angel J Piscola
@Redmega
Aug 18 2016 05:34
@revisualize Which one, the titleCase()?
Cindy
@qdkueh
Aug 18 2016 05:34
sublime text
Joseph
@revisualize
Aug 18 2016 05:34
@Redmega Yes.
Angel J Piscola
@Redmega
Aug 18 2016 05:34
@lazyCoder036 I'm a fan of Visual Studio Code
lazy_bunny
@lazyCoder036
Aug 18 2016 05:35
can I code php there ?
Angel J Piscola
@Redmega
Aug 18 2016 05:35
Yep
Theres a php plugin for syntax hilighting, linting, etc
Plugins for almost every language, actually
llamatarianism
@llamatarianism
Aug 18 2016 05:35
inb4 this chat room turns into /textEditorReligiousWars
Markus Kiili
@Masd925
Aug 18 2016 05:35
@qdkueh You can store destroyers arguments on a variable var args = arguments; and then you can use args inside the callback.
lazy_bunny
@lazyCoder036
Aug 18 2016 05:35
what about atom
Angel J Piscola
@Redmega
Aug 18 2016 05:35
every non-esoteric language**
Joseph
@revisualize
Aug 18 2016 05:35
@lazyCoder036 Sublime, Brackets, Atom, Visual Studio Code, www.c9.io , www.repl.it , www.github.com ... ummmmm.
llamatarianism
@llamatarianism
Aug 18 2016 05:35

V I M

Angel J Piscola
@Redmega
Aug 18 2016 05:35
@llamatarianism pls no :(
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:36
can someone please explain me uses of constructors
lazy_bunny
@lazyCoder036
Aug 18 2016 05:36
I once tried VIM
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:36
and what is making an instance of a constructor
llamatarianism
@llamatarianism
Aug 18 2016 05:36
@swapnildaddikar constructors are used to make objects
from this chapter
lazy_bunny
@lazyCoder036
Aug 18 2016 05:36
its learning curve is so steep I almost break my neck :P
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:36
@llamatarianism
llamatarianism
@llamatarianism
Aug 18 2016 05:36
here's an example:
Joseph
@revisualize
Aug 18 2016 05:36
@llamatarianism Are you seriously a VIM user?
Angel J Piscola
@Redmega
Aug 18 2016 05:36
I'm convinced @llamatarianism is octocat and types with 8 limbs
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:36
pls help me @llamatarianism
llamatarianism
@llamatarianism
Aug 18 2016 05:36
function Foo() {
  this.bar = "baz";
}

const foo = new Foo();
console.log(foo.bar); // "baz"
console.log(foo instanceof Foo); // true
Foo is a constructor function
@revisualize yes
Joseph
@revisualize
Aug 18 2016 05:37
@llamatarianism No wonder you're smarter than me.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:37
so it creates an object?
llamatarianism
@llamatarianism
Aug 18 2016 05:37
yes
you create objects using a constructor like this:
new ConstructorFunction();
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:37
but if we can normally create objects
lazy_bunny
@lazyCoder036
Aug 18 2016 05:37
is Atom any good
llamatarianism
@llamatarianism
Aug 18 2016 05:37
the new operator tells it to make a new object
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:37
why use constructors
lazy_bunny
@lazyCoder036
Aug 18 2016 05:37
its open source
one of my friend recommend it
Joseph
@revisualize
Aug 18 2016 05:37
@lazyCoder036 They're all good. Some have their pluses and minuses.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:38
hey @llamatarianism could u please look at that link and tell me
Joseph
@revisualize
Aug 18 2016 05:38
@lazyCoder036 Sublime is one of the most popular.
llamatarianism
@llamatarianism
Aug 18 2016 05:38
@swapnildaddikar you have to create a Car object
lazy_bunny
@lazyCoder036
Aug 18 2016 05:38
@revisualize sublime is not free
llamatarianism
@llamatarianism
Aug 18 2016 05:38
look at how I made a Foo object: new Foo();
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:38
yes so we have created a car object right?
lazy_bunny
@lazyCoder036
Aug 18 2016 05:38
@revisualize I am a free loader :P
Joseph
@revisualize
Aug 18 2016 05:38
@lazyCoder036 You're right. It's not. But, you don't have to pay for it.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:38
var myCar=new Car();
what is this then?
llamatarianism
@llamatarianism
Aug 18 2016 05:39
@swapnildaddikar
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 5;
};
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:39
the Car is a constructor
llamatarianism
@llamatarianism
Aug 18 2016 05:39
^ that is the constructor function that creates Car objects
Cindy
@qdkueh
Aug 18 2016 05:39
@Masd925 the for loop wont go to argument[2] O___O im tearing my hair off
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:39
yes so this is a constrctor
llamatarianism
@llamatarianism
Aug 18 2016 05:39
new Car() creates a Car object
Suraj Prasad
@suraj18gts
Aug 18 2016 05:39
function myFunctionWithArgs(a, b) {
console.log(a + b);
}
myFunctionWithArgs(1, 2);
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:39
im not getting u @llamatarianism sorry :(
Suraj Prasad
@suraj18gts
Aug 18 2016 05:39
is this code is correct or not??
llamatarianism
@llamatarianism
Aug 18 2016 05:40
@swapnildaddikar Car is not a Car object
it is a function that creates them
Joseph
@revisualize
Aug 18 2016 05:40
@lazyCoder036 Sublime Text is downloaded as a fully functional evaluation that doesn't have an expiration for evaluation.
llamatarianism
@llamatarianism
Aug 18 2016 05:40
and you don't call constructor functions the same way you do normal functions
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:40
ok listen @llamatarianism
Markus Kiili
@Masd925
Aug 18 2016 05:40
@qdkueh Post the code again.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:40
var myCar=new Car();
llamatarianism
@llamatarianism
Aug 18 2016 05:40
you call a normal function like this: foo()
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:40
when i say this
lazy_bunny
@lazyCoder036
Aug 18 2016 05:40
@revisualize but constant reminder is annoying
llamatarianism
@llamatarianism
Aug 18 2016 05:40
var myCar=new Car(); creates a new Car object
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:41
myCar has the properties defined in the car functuion?
llamatarianism
@llamatarianism
Aug 18 2016 05:41
and assigns that object to myCar
@swapnildaddikar yes
Cindy
@qdkueh
Aug 18 2016 05:41

@Masd925
```js
function destroyer(arr) {
// Remove all the values
var args = arguments;
function whatwewant(value) {
for (i=1; i<args.length; i++) {
return value !== args[i];
}
}
var filtered = arr.filter(whatwewant);
return filtered;
}

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

swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:41
woow
@llamatarianism thanks a lot
CamperBot
@camperbot
Aug 18 2016 05:41
swapnildaddikar sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:star2: 1221 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
lazy_bunny
@lazyCoder036
Aug 18 2016 05:41
@revisualize and one more issue is I have linux
Cindy
@qdkueh
Aug 18 2016 05:41
@Masd925
function destroyer(arr) {
  // Remove all the values
  var args = arguments;
  function whatwewant(value) {
    for (i=1; i<args.length; i++) {
      return value !== args[i];
    }
  }
var filtered = arr.filter(whatwewant);
return filtered;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
lazy_bunny
@lazyCoder036
Aug 18 2016 05:41
@revisualize so can't use visual studio code
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:41
so new keyword is used to create pobjects from constrcutor functions
Joseph
@revisualize
Aug 18 2016 05:41
@lazyCoder036 So.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:41
?
llamatarianism
@llamatarianism
Aug 18 2016 05:41

@swapnildaddikar to answer this question:

why use constructors

constructors let you define new kinds of objects

swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:41
@llamatarianism
Markus Kiili
@Masd925
Aug 18 2016 05:41
@qdkueh You are returning based on the first looped argument, so the loop stops at once.
llamatarianism
@llamatarianism
Aug 18 2016 05:41
for example, an Array is a type of object
@swapnildaddikar yes, new is used to create objects
Joseph
@revisualize
Aug 18 2016 05:41
@lazyCoder036 I have linux as well.
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:42
thanks a lot @llamatarianism
CamperBot
@camperbot
Aug 18 2016 05:42
swapnildaddikar sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:warning: swapnildaddikar already gave llamatarianism points
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:42
so what were u saying
about the need
CamperBot
@camperbot
Aug 18 2016 05:42
you need to ask about @someone!
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:42
of it
Cindy
@qdkueh
Aug 18 2016 05:42
@Masd925 so i need to add an if?
llamatarianism
@llamatarianism
Aug 18 2016 05:42
those new types of objects have a property called prototype
Suraj Prasad
@suraj18gts
Aug 18 2016 05:42
function myFunctionWithArgs(a, b) {
console.log(a + b);
}
myFunctionWithArgs(1, 2);
Joseph
@revisualize
Aug 18 2016 05:42
@lazyCoder036 https://code.visualstudio.com/download .. Linux download.
Suraj Prasad
@suraj18gts
Aug 18 2016 05:42
function myFunctionWithArgs(a, b) {
console.log(a + b);
}
myFunctionWithArgs(1, 2);
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:42
oh
Suraj Prasad
@suraj18gts
Aug 18 2016 05:42
it is correct or not'
??
llamatarianism
@llamatarianism
Aug 18 2016 05:42
an object's prototype is something that it inherits properties from
Markus Kiili
@Masd925
Aug 18 2016 05:42
@qdkueh Check if the looped argument is equal to value and return false in that case. After loop return true.
llamatarianism
@llamatarianism
Aug 18 2016 05:42
so for example, I could do this:
Car.prototype = new Array();
and all Car objects would have all the same properties as arrays do
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:43
ohh
so here array is the constructor ?
llamatarianism
@llamatarianism
Aug 18 2016 05:43
yes
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:43
ok sy
so
var myCar=new Car();
when i say this
same thing is happening
llamatarianism
@llamatarianism
Aug 18 2016 05:43
correct
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:43
myCar is getting
all proeprties
from Car
llamatarianism
@llamatarianism
Aug 18 2016 05:43
yep
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:44
so the prototype thing
is the same as this thing
llamatarianism
@llamatarianism
Aug 18 2016 05:44
no
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:44
ok i wont bother u more unless i read it about it myself
thanks a lot :D
llamatarianism
@llamatarianism
Aug 18 2016 05:44
no problem
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:44
also i more doubt
whats the use of this keyword?
i tried to read it fdrom the net
didnt get it much
manusia123
@manusia123
Aug 18 2016 05:45

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  var filtered = arr.filter(bouncerexe);
  return arr;
}

function bouncerexe(arr) {
  return (!isNaN,!false,!"");
}

bouncer([7, "ate", "", false, 9]);
how to filter falsy value in javascript ?
Cindy
@qdkueh
Aug 18 2016 05:45
@Masd925 omg it works thanks so much for your patience to teach this newb. thanks alot you da best!
CamperBot
@camperbot
Aug 18 2016 05:45
qdkueh sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2315 | @masd925 |http://www.freecodecamp.com/masd925
llamatarianism
@llamatarianism
Aug 18 2016 05:45
this is sorta hard to explain
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:45
hahaha
okay for now ill let it go
llamatarianism
@llamatarianism
Aug 18 2016 05:45
you can think of like "context"
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:45
hmm
Markus Kiili
@Masd925
Aug 18 2016 05:45
@swapnildaddikar All cars inherit from Car.prototype, not Car. Car is the constructor function and Car.prototype is an object (plain object by default).
llamatarianism
@llamatarianism
Aug 18 2016 05:46
so inside the Car constructor
this (the current context) is the Car object that is being created
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:46
@Masd925 thanks
CamperBot
@camperbot
Aug 18 2016 05:46
swapnildaddikar sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2316 | @masd925 |http://www.freecodecamp.com/masd925
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:46
hmm
so its related to the current object?
it says on the site
llamatarianism
@llamatarianism
Aug 18 2016 05:46
yes
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:46
it points tpo the current object
being created
by i didnt understand it much
Angel J Piscola
@Redmega
Aug 18 2016 05:46
the object its inside of
swapnildaddikar
@swapnildaddikar
Aug 18 2016 05:46
but *
llamatarianism
@llamatarianism
Aug 18 2016 05:47
you can also use this inside functions that are part of an object's prototype
example:
Markus Kiili
@Masd925
Aug 18 2016 05:47
@swapnildaddikar When you use new keyword, the engine creates a new plain object and puts it as value of this and then the constructor code is run once. The new object gets all the properties defined by this.propName=...
llamatarianism
@llamatarianism
Aug 18 2016 05:47
Car.prototype.honk = function() {
  console.log(this);
  return "BEEP BEEP";
};

myCar.honk();
// logs `myCar` to the console
swapnildaddikar