These are chat archives for FreeCodeCamp/HelpJavaScript

11th
Mar 2017
Blauelf
@Blauelf
Mar 11 2017 00:00
@conradOU result points to the same array as arr, and you add elements to result, while you use arr.length as the loop's limit, so you increase the upper bounds, creating an infinite loop.
1st: Initialise the result array to an empty array, not an existing one, and especially not one you're looping
2nd: Push once if none of the args[j] matched your arr[i]
David
@dkohlruss
Mar 11 2017 00:03
@Barney-McRubble If you want to filter contacts so that it returns arrays that have 2 likes...
var filteredContacts = contacts.filter(function(contact) {
return contact.likes.length === 2;
});
Blauelf
@Blauelf
Mar 11 2017 00:05
@Barney-McRubble You should not do anything on a name mismatch in the loop. Return "No such contact" if none of the contacts had a matching name, not on the first mismatch.
boneyfantaseas
@boneyfantaseas
Mar 11 2017 00:05
@Barney-McRubble you need one for loop to iterate over the array items and then a condition to check whether you have the right entry (compare firstName) and another to see if the given prop exists.
David
@dkohlruss
Mar 11 2017 00:06
Oh, I misunderstood the question then, my bad
Thought he meant the array within each object (likes) that only contains 2 values
and returning only the objects that have 2 values in the likes array
Jordan Swanson
@Barney-McRubble
Mar 11 2017 00:09
My code find the matching firstName, but not the prop. So a properly coded if statement should work for the prop as well?
boneyfantaseas
@boneyfantaseas
Mar 11 2017 00:10
gotcha, nice approach for that, though. I finished that task earlier this night, so I knew what code he needed :)
exactly. Remember that your prop is noted via brace notation such as contact[prop] where contact is your current contact, something like contacts[i] inside your for loop
Jordan Swanson
@Barney-McRubble
Mar 11 2017 00:12
Oh I think I see. Okay, I will continue look for the code to locate the matching prop. I appreciate your help :)
boneyfantaseas
@boneyfantaseas
Mar 11 2017 00:14
very welcom
e
Craig Warren
@stream8media
Mar 11 2017 00:21
Hi everyone, looking for bit of help with this one, driving me nuts. Ok FirtLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine written using escape chars so this is all i can see as the only way to do this var myStr = "FirstLine\n\SecondLine\\rThirdLine"; yet i'm told this is wrong
correction this is what i have var myStr = "FirstLine\n\SecondLine\\rThirdLine";
Jason Luboff
@JLuboff
Mar 11 2017 00:23
@stream8media Can you put your code between two backticks ` please
David
@dkohlruss
Mar 11 2017 00:25
var myStr = "FirstLine\n\SecondLine\\rThirdLine";
is going to get parsed as:
Firstline
\Secondline\
Thirdline
I think. I don't recall exactly what carriage return does because I've never used it
Jason Luboff
@JLuboff
Mar 11 2017 00:26
@dkohlruss Its similar to new line but I can't remember the exact differences
David
@dkohlruss
Mar 11 2017 00:28
I'll just throw it into node... lol
console.log(myStr);
FirstLine
SecondLine\rThirdLine
huh. interesting
Zaluth
@Zaluth
Mar 11 2017 00:29
is there a way to disable the window, just like when you have an alet box and can't click on anything else while the alert is being displayed?
Jason Luboff
@JLuboff
Mar 11 2017 00:29

From wikipedia

.....is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed and newline concepts, although it can be considered separately in its own right.

David
@dkohlruss
Mar 11 2017 00:29
What window?
Zaluth
@Zaluth
Mar 11 2017 00:30
the parent element
David
@dkohlruss
Mar 11 2017 00:30
do you mean the window Object? or a parent div to something?
or this window that we're chatting in?
Zaluth
@Zaluth
Mar 11 2017 00:31
the object
David
@dkohlruss
Mar 11 2017 00:35
You can disable window resize or scrolling, but as far as not being able to click on anything other than some sort of notice div, that would have to be done using CSS, not with the window Object. If, for example, you want to have a confirmation div show up that the user has to click on for whatever reason, you could use javascript to append a div the size of the browser window (good idea to set the background to grey with a lower opacity to UX reasons), set its z-index above all other elements, and then append another div that is the alert with its z-index higher than the overlay
Zaluth
@Zaluth
Mar 11 2017 00:37
@dkohlruss hmm i'll give it a try, thanks
CamperBot
@camperbot
Mar 11 2017 00:37
zaluth sends brownie points to @dkohlruss :sparkles: :thumbsup: :sparkles:
:cookie: 184 | @dkohlruss |http://www.freecodecamp.com/dkohlruss
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 00:49

Could someone help me with the challenge Profile Lookup? When I remove the else statements, it gives me the first 3 out of 5 checkmarks. But when add the the else statements, they remove the 3 checkmarks and give me the last 2 out of 5 checkmarks.

Here is the code:


//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
  for(var i = 0; i < contacts.length; i++){

    var check = contacts[i].hasOwnProperty(prop);
    var Obj = contacts[i].firstName;
    var Prop = contacts[i][prop];

    if(Obj === firstName){
      if(check === true){
        return Prop;
      }else{
        return "No such property";
      }
    }else{
      return "No such contact";
    }
  }
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Sherlock", "likes");
Upkar Lidder
@lidderupk
Mar 11 2017 00:49

hi all. Have a regex question. Looking for any string that has “quite” case insensitive.
This is the target string: "All Quiet on the Western Front”
this does not work: /.Quite./gi
this works: /.Front./gi

Is quite a keyword that needs to be escaped? Thanks.

David
@dkohlruss
Mar 11 2017 00:50
Quite is not the same at Quiet ;-)
@SomeRandomGuy0 could you link to your browser window where you're typing the answer for me?
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 00:51
https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20contacts.length%3B%20i%2B%2B)%7B%0A%20%20%20%20%0A%20%20%20%20var%20check%20%3D%20contacts%5Bi%5D.hasOwnProperty(prop)%3B%0A%20%20%20%20var%20Obj%20%3D%20contacts%5Bi%5D.firstName%3B%0A%20%20%20%20var%20Prop%20%3D%20contacts%5Bi%5D%5Bprop%5D%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20if(Obj%20%3D%3D%3D%20firstName)%7B%0A%20%20%20%20%20%20if(check%20%3D%3D%3D%20true)%7B%0A%20%20%20%20%20%20%20%20return%20Prop%3B%0A%20%20%20%20%20%20%7Delse%7B%0A%20%20%20%20%20%20%20%20return%20%22No%20such%20property%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7Delse%7B%0A%20%20%20%20%20%20return%20%22No%20such%20contact%22%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Sherlock%22%2C%20%22likes%22)%3B%0A
Paulo Raoni
@paulo-raoni
Mar 11 2017 00:53
Could someone tell me why this code, for MUTATIONS challenge, is not working?
Upkar Lidder
@lidderupk
Mar 11 2017 00:53
@dkohlruss :(. I see why they won’t give me a pay raise :(.
Paulo Raoni
@paulo-raoni
Mar 11 2017 00:53

function mutation(arr) {

arr[0] = arr[0].toLowerCase();
arr[1] = arr[1].toLowerCase();
var out = [];
var outPut;

for (var i = 0; i < arr[1].length; i++){

  for (var j = 0; j < arr[0].length; j++){

    if (arr[1].indexOf(i) === arr[0].indexOf(j)){
      out[i] = arr[1].indexOf(i);
    }

  }

}

return out;
}

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

Can someone help me?
David
@dkohlruss
Mar 11 2017 00:57
@SomeRandomGuy0 Instread of using the hasOwnProperty method, I just checked if contacts[i][prop] existed with the conditional statement if (contacts[i][prop]) { etc etc etc
Raihan Habib
@mrh07
Mar 11 2017 00:57
can't understand this instruction https://www.freecodecamp.com/challenges/stand-in-line
Manish Giri
@Manish-Giri
Mar 11 2017 00:58
@paulo-raoni are you sure .indexOf(i) and .indexOf(j) is right?
Sohel-ASM
@Sohel-ASM
Mar 11 2017 00:59
@mrh07 Me also got stuck in this problem yesterday. I will send you the screenshot of my solution.
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 00:59
@dkohlruss It still works either way but the thing is that if I add the else statements, it gives me the last 2 checkmarks. But if I remove them, it gives me the first 3 checkmarks and remove the last 2
Raihan Habib
@mrh07
Mar 11 2017 01:00
@Sohel-ASM tnx , it will better for me
CamperBot
@camperbot
Mar 11 2017 01:00
mrh07 sends brownie points to @sohel-asm :sparkles: :thumbsup: :sparkles:
:cookie: 196 | @sohel-asm |http://www.freecodecamp.com/sohel-asm
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:00
blob
@mrh07
@mrh07 You got it Raihan?
Raihan Habib
@mrh07
Mar 11 2017 01:02
@Sohel-ASM is there any possibilties to explain
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:03
@mrh07 sure. The instruction is confusing.
Conrad
@conradOU
Mar 11 2017 01:03
function isBigEnough(element) {
  return element >= num;
}

function getIndexToIns(arr, num) {
  arr.sort();
  if (arr.includes(num)) {
    return arr.indexOf(num);
  } 
  return arr.indexOf(arr.find(isBigEnough)) - 1;
}

getIndexToIns([10, 20, 30, 40, 50], 35);
how can I make variable num in isBigEnough() reference to num in getIndexToIns() ? Does JS have global variables?
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:04

Hi all, I'm trying to teach myself functional JavaScript, using the Symmetric Difference problem (https://www.freecodecamp.com/challenges/symmetric-difference) as an example. I believe that the problem is possible to solve in "one line" (i.e., one composed function call), but the solution I came up with is rather dirty. Does anyone have any suggestions on how to improve this?

function sym(args) {
return Array.from(arguments)
.reduce((acc,val)=>{
val.filter((x,i)=>val.indexOf(x)===i)
.forEach(x=>{
console.log(acc,x);
acc=(acc.indexOf(x)<0)?acc.concat(x):acc.filter(y=>y!==x)
})
return acc;
},[]);
}

whoops
Conrad
@conradOU
Mar 11 2017 01:04
@Blauelf thanks for the previous reply, I passed the tests
CamperBot
@camperbot
Mar 11 2017 01:04
conradou sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:04
function sym(args) { return Array.from(arguments) .reduce((acc,val)=>{ val.filter((x,i)=>val.indexOf(x)===i) .forEach(x=>{ console.log(acc,x); acc=(acc.indexOf(x)<0)?acc.concat(x):acc.filter(y=>y!==x) }) return acc; },[]); }
CamperBot
@camperbot
Mar 11 2017 01:04
:star2: 3802 | @blauelf |http://www.freecodecamp.com/blauelf
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:04
No... hold on sorry I'm new haha
Raihan Habib
@mrh07
Mar 11 2017 01:04
@Sohel-ASM how there is extra word 'push' 'shift' ?
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:05
function sym(args) {
    return Array.from(arguments)
    .reduce((acc,val)=>{
        val.filter((x,i)=>val.indexOf(x)===i)
        .forEach(x=>{
            console.log(acc,x);
            acc=(acc.indexOf(x)<0)?acc.concat(x):acc.filter(y=>y!==x)
        })
        return acc;
    },[]);
}
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:06
@Sohel-ASM You have to add an item in the array, which I did in the 4th line. Then you have to take the first item out of the array, which I can do in two way- by either writing the code in the next line as: item = arr.shift(); and then keep the return line intact. or I can modify the return line as: return arr.shift();
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 01:06
So I'm guessing no one is going to help me?
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:07
@mrh07 I didn't understand your question completely? which 'push' or 'shift' you are talking about?
Raihan Habib
@mrh07
Mar 11 2017 01:08
@Sohel-ASM those were not in the instruction .
Paulo Raoni
@paulo-raoni
Mar 11 2017 01:09
code
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:09
@SomeRandomGuy0 I'll look into it
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:09
@mrh07 that's why I said the instruction is confusing, which was more complicated by the first line of the code.
the0ffh
@the0ffh
Mar 11 2017 01:09

Hey!
Could someone help me with regex?

function spinalCase(str) {
  return ('<<<<'+str.replace(/(([A-Z]):?)/g, ("_$1"))).replace(/(<<<<_)|(<<<<)/,'').replace(/(_)|( _)|( )/g,'-').toLowerCase();

Should i simply replace '--' by '-' in the output string or is there better way of doing it?

Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:10
Ah @SomeRandomGuy the way your code is set up, if the first person isn't who you're looking for, it immediately returns "no such contact". Move that return statement to after the end of the loop
the0ffh
@the0ffh
Mar 11 2017 01:10
I missed } - sorry!
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:10
@the0ffh what's your regex supposed to do?
Raihan Habib
@mrh07
Mar 11 2017 01:11
ok
the0ffh
@the0ffh
Mar 11 2017 01:11
@oliverpdaniel I'm trying to beat 'Spinal Tap Case' part.
Sohel-ASM
@Sohel-ASM
Mar 11 2017 01:11
@mrh07 Anyway, it took me a long time to understand too, and extensive help from two other coders of this forum to understand it properly.
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 01:11
@oliverpdaniel Thanks
CamperBot
@camperbot
Mar 11 2017 01:11
somerandomguy0 sends brownie points to @oliverpdaniel :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @oliverpdaniel |http://www.freecodecamp.com/oliverpdaniel
the0ffh
@the0ffh
Mar 11 2017 01:11
Apparently i didn't copy everything - shame on me. Here it goes:
function spinalCase(str) {
  return ('<<<<'+str.replace(/(([A-Z]):?)/g, ("_$1"))).replace(/(<<<<_)|(<<<<)/,'').replace(/(_)|( _)|( )/g,'-').toLowerCase();
}
spinalCase("The_Andy_Griffith_Show");
@oliverpdaniel sorry for being rude. This is the expected output:
spinalCase("This Is Spinal Tap") should return "this-is-spinal-tap".
spinalCase("thisIsSpinalTap") should return "this-is-spinal-tap".
spinalCase("The_Andy_Griffith_Show") should return "the-andy-griffith-show".
spinalCase("Teletubbies say Eh-oh") should return "teletubbies-say-eh-oh".
spinalCase("AllThe-small Things") should return "all-the-small-things".
David
@dkohlruss
Mar 11 2017 01:14
My regex was not as complicated as that, personally
What does your output?
*yours
for mine, I made a Regex variable for any lower-case letter followed by any upper-case letter var regexThing = /[a-z][A-Z]/
and then inserted a space wherever that happens
and then did replace method calls for \s with '-' and _ with '-' globally
Some Random Guy
@SomeRandomGuy0
Mar 11 2017 01:16
@oliverpdaniel I gtg. You can stop trying to help me now.
David
@dkohlruss
Mar 11 2017 01:16
and then called toLowerCase()
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:16
@the0ffh I don't even know what you could possibly have been rude about so you're good to go! XD
the0ffh
@the0ffh
Mar 11 2017 01:19
@dkohlruss Thanks! How do you place a character between [a-z][A-Z]?
CamperBot
@camperbot
Mar 11 2017 01:19
the0ffh sends brownie points to @dkohlruss :sparkles: :thumbsup: :sparkles:
:cookie: 185 | @dkohlruss |http://www.freecodecamp.com/dkohlruss
Oliver Daniel
@oliverpdaniel
Mar 11 2017 01:19
@the0ffh [a-zA-Z] should work fine
oh sorry I misunderstood, shame on me for not paying attention
the0ffh
@the0ffh
Mar 11 2017 01:20
@oliverpdaniel Nothing happened :]
David
@dkohlruss
Mar 11 2017 01:22
@the0ffh I used a for loop
```
var regex = /[a-z][A-Z]/g;
  //Regex lower-case then upper case => dashes
  var insertSpace = str.search(regex) + 1;
  for (insertSpace; insertSpace > 0; insertSpace = str.search(regex) + 1) {
    str = str.slice(0,insertSpace) + ' ' + str.slice(insertSpace);
  }
the0ffh
@the0ffh
Mar 11 2017 01:23
Thanks again! I'm not thinking today
Albert L. C.
@sirus3020
Mar 11 2017 01:38
guys is this a bug?
'algorithm' doesnt work but 'Algorithm' does, even 'consonant' works.
nvm
im stupid.
lol
Joseph
@revisualize
Mar 11 2017 01:41
Hey.
Conor Murphy
@cmurphy580
Mar 11 2017 01:45
If you hover the background in the header it zooms in. Is there any way to keep the elements' position on the background fixed?
http://codepen.io/cmurphy580/pen/ygaWbG?editors=1100
achudoz
@achudoz
Mar 11 2017 01:49
HI, I am doing the No Repeats Please algorithm challenge and I just tried to rewrite the the heap's algorithm from the pseudocode on Wikipedia, but when I try to test it, the script crashes. This sometimes happens with this computer even when using things like Facebook or Gitter, since It's a 10yo laptop, so I don't know if it's one of it's shenanigans or if it's my code. Could anyone please have a look at it, or just try to open the "No Repeats Please" challenge (Advanced Algorithms), run it there and tell me if it returns an array of 6 different permutations as it should? I won't be near my not-so-shitty computer for at least another 5 hours and I just need to know. :D Here is the code:

function permAlone(str) {
  var elements = str.split(""),
      permutations = [];

  function permutuj(n, arr) {
    if (n==1) {
      permutations.push(arr.join(""));
    } else { for (var i=0; i<n-1; i++) {
      permutuj(n-1, arr);
      if (n%2===0) {
        holder = arr[i];
        arr[i] = arr[n-1];
        arr[n-1] = holder;
      } else {
        holder = arr[0];
        arr[0] = arr[n-1];
        arr[n-1] = holder;
      }
    }
      permutuj(n-1, arr);
    }

  }

  permutuj(elements.length, elements);
  return permutations;
}

permAlone('aab');
Michael Grienauer
@mgrienauer
Mar 11 2017 01:53

function myReplace(str, before, after) {
  var strArr = str.split(' ');
  var afterArr = after.split('');

  for(var i=0; i<strArr.length;i++){
    if (strArr[i].toLowerCase() == before.toLowerCase() && strArr[i][0] == strArr[i][0].toUpperCase()){
      var removed = afterArr.splice(0,1,afterArr[0].toUpperCase());
      strArr.splice(i,1,afterArr.join(''));
    }
    else if(strArr[i] == before){
      strArr.splice(i,0,after);
    }
  }
  //return strArr;
}

myReplace("A quick brown fox Jumped over the lazy dog", "jumped", "leaped");
doing search and replace challenge but im getting an infinite loop at line 7...but i can't see it
any ideas?
Michael Grienauer
@mgrienauer
Mar 11 2017 02:07
shiiiiiiet
AKS
@amitkumarsarangi
Mar 11 2017 02:17
@mike93og93 because your splice statement adds an element after every loop and length keeps increasing
Michael Grienauer
@mgrienauer
Mar 11 2017 02:18
@amitkumarsarangi i figured it out and used replace on the original string
@amitkumarsarangi thanks though
CamperBot
@camperbot
Mar 11 2017 02:18
mike93og93 sends brownie points to @amitkumarsarangi :sparkles: :thumbsup: :sparkles:
:cookie: 309 | @amitkumarsarangi |http://www.freecodecamp.com/amitkumarsarangi
AKS
@amitkumarsarangi
Mar 11 2017 02:19
@mike93og93 :+1:
Conor Murphy
@cmurphy580
Mar 11 2017 02:23
anyone know how to keep the elements on background that has a zoom in transform fixed?
http://codepen.io/cmurphy580/pen/ygaWbG?editors=1100
cwxr
@cwxr
Mar 11 2017 02:26
Hi guys anyone knows where did i went wrong with this?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "This 'myNoun' is 'myAdjective' and it 'myVerb' very 'myAdverb'";

// Your code above this line
return result;
}

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

wordBlanks("","","","") should return a string.
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).

Mark Madison
@luciano991
Mar 11 2017 02:30

@cwxr this is the solution that worked for me. Do you have questions?
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "I love it when my " + myNoun + " was " + myAdjective + " and " + myVerb + "'" + myAdverb + ".";
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("friend", "fat", "walked", "slowly");

iandelible
@iandelible
Mar 11 2017 02:31
@cwxr your result is passing in a string not passing in the variable of the arguments passed by the function
Ayush Bahuguna
@relentless-coder
Mar 11 2017 02:31
1 var rectangle = {
 2     create: function (width, height) {
 3         var self = Object.create(this);
 4         self.height = height;
 5         self.width = width;
 6         return self;
 7     }
so in here Object.create(this) creates and object self who prototype is rectangle?
cwxr
@cwxr
Mar 11 2017 02:35
@luciano991 @iandelible Thank you both for the help!
CamperBot
@camperbot
Mar 11 2017 02:35
cwxr sends brownie points to @luciano991 and @iandelible :sparkles: :thumbsup: :sparkles:
:cookie: 161 | @luciano991 |http://www.freecodecamp.com/luciano991
:cookie: 269 | @iandelible |http://www.freecodecamp.com/iandelible
Joseph
@revisualize
Mar 11 2017 02:43
Hey.
Ayush Bahuguna
@relentless-coder
Mar 11 2017 02:48
const person = {
  create: function(name, age, sex){
    const self = Object.create(this);
    self.name = name;
    self.age = age;
    self.sex = sex;
  },

  description: function(){
    return `${this.name} is ${this.age} years old. Oh, ${this.name} is a ${this.sex}`
  }
}

const ayush = person.create("Ayush Bahuguna", 22, "male");


console.log(ayush);
here ayush is undefined. why?
Hi @revisualize
okay okay okay
forgot to return self
Eric Long
@ejlong90
Mar 11 2017 02:59

I am doing Escape Sequences in Strings, my instructions are as follows:
Assign the following three lines of text into the single variable myStr using escape sequences.

FirstLine
\SecondLine\
ThirdLine

this is my code: var myStr="n\FirstLine\nr\SecondLine\r\ThirdLine\";

what am i doing wrong?
Nataly C.
@cstpk
Mar 11 2017 03:00
@ejlong90 you shouldnt have n\ in the beginning and there are some \ missing
Eric Long
@ejlong90
Mar 11 2017 03:01
@natalyscosta yeah after i changed that the only error im getting is:
myStr should have encoded text with the proper escape sequences and no spacing.
Ayush Bahuguna
@relentless-coder
Mar 11 2017 03:04
@eric are you sure about '\nr\' after "FirstLine"?
also the extra \ at the end
also a helpful tip in order to have \ as an output you need to escape it with using an extra \.
Eric Long
@ejlong90
Mar 11 2017 03:10
var myStr="FirstLine\n\SecondLine\\rThirdLine";??
iandelible
@iandelible
Mar 11 2017 03:11
@ejlong90 mentioned above is that a backslash also needs an escape sequence. i think you almost have it
Ayush Bahuguna
@relentless-coder
Mar 11 2017 03:12

I think you are supposed to get this output

"FirstLine
\SecondLine\
ThirdLine"

so you need \ before and after "SecondLine". How do you think you'd be able to do that?

Eric Long
@ejlong90
Mar 11 2017 03:13
"\SecondLine\"
thats weird i had \ before and after "SecondLine" and it changed when i hit enter and also i think that answers my issue
Ayush Bahuguna
@relentless-coder
Mar 11 2017 03:15
sir, you are not reading our replies properly. You are supposed to escape \ before and after SecondLine. please refer to above messages
Eric Long
@ejlong90
Mar 11 2017 03:15
thank you guys i got it finally @iandelible @relentless-coder @natalyscosta
CamperBot
@camperbot
Mar 11 2017 03:15
ejlong90 sends brownie points to @iandelible and @relentless-coder and @natalyscosta :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @iandelible |http://www.freecodecamp.com/iandelible
:cookie: 302 | @natalyscosta |http://www.freecodecamp.com/natalyscosta
:cookie: 338 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
Daniel
@Dutchie1990
Mar 11 2017 03:27

```
function caseInSwitch(val) {
var answer = "";
// Only change code below this line

case : 1
answer = "alpha";
break;
case: 2
answer ="beta"
break;
case: 3
answer ="gamma"
break;
case: 4
answer ="delta"
break;

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

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

``` Anybody can help with the structure of case switches?

Adam VanZuiden
@adamvz
Mar 11 2017 03:29
@Dutchie1990 you are close! You do need to add the switch statement though!
Your current code is just a list of cases. You need to add the switch function. Refer to the example of how that's formed.
Roxroy
@roxroy
Mar 11 2017 03:30
@Dutchie1990 , switch is missing after //Only change below this line
will
@williezerocool
Mar 11 2017 03:45

wondering why the values I push into my array keep disappearing as my loop continues to run and adds more values to my array. I've wrote the code a few different ways but i never get my desired result which is to loop thru i by a certain number & store each number I land on in i in myArr ```
function getEvens(a, b, c){

for(var i = a; i < b; i++){
while(i < b){
  var myArr = [];
  i += c;
  if(i < b){
    myArr.push(i);
    }
  }
return myArr;
}
}
getEvens(4,20,3);

```

Daniel
@Dutchie1990
Mar 11 2017 03:50
@adamvz @roxroy thx, it worked perfectly :)
CamperBot
@camperbot
Mar 11 2017 03:50
:cookie: 376 | @roxroy |http://www.freecodecamp.com/roxroy
dutchie1990 sends brownie points to @adamvz and @roxroy :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @adamvz |http://www.freecodecamp.com/adamvz
Roxroy
@roxroy
Mar 11 2017 03:50
@williezerocool , var myArr = []; will reset the array to blank each time you loop
This message was deleted
@Dutchie1990 , glad to have help. Now you can move on to your the next challenge.
Gulsvi
@gulsvi
Mar 11 2017 04:00

If I want to do add(5)(8), I can do const add = a => b => a + b;, but how would I make a function take any number of arguments?

add(1)(2)(3); // 6
add(1)(2)(3)(4); // 10
add(1)(2)(3)(4)(5); // 15

Not really getting how to curry right now...

Roxroy
@roxroy
Mar 11 2017 04:06
@SkyCoder01 , you should use the arguments array to get the parameters
Gulsvi
@gulsvi
Mar 11 2017 04:07
@roxroy I tried that, but it doesn't work with arrow functions.
errr arrow notation I mean
Joseph
@revisualize
Mar 11 2017 04:08
@SkyCoder01 Currying.
Roxroy
@roxroy
Mar 11 2017 04:08
@SkyCoder01 , which challenge are you doing again?
Gulsvi
@gulsvi
Mar 11 2017 04:08
We don't learn currying at FCC, so just practicing outside of FCC for now.
Without arrow notation, arguments doesn't work either:
function add(a) {
  return function (b) {
    console.log(arguments); //[object Arguments] {0: 8}
    return a + b; // 9
  }
}
add(1)(8);
will
@williezerocool
Mar 11 2017 04:18
@roxroy thanks
CamperBot
@camperbot
Mar 11 2017 04:18
williezerocool sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:cookie: 377 | @roxroy |http://www.freecodecamp.com/roxroy
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:18
var remainder; 10 % 4 = 2;
What's wrong with it?
Nataly C.
@cstpk
Mar 11 2017 04:20
@MathematicsCoding syntax. var remainder = ....... ;
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:21
var remainder= 10 % 4;
Got it thanks
I thought I had to add "= 2;" or something...
Roxroy
@roxroy
Mar 11 2017 04:22
@MathematicsCoding , the ans will be 2, and it goes into remainder
@MathematicsCoding , use = to set the next value and == to compare things
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:23
yeah...
Im just reviewing :p
Im done with it and Im still dont get this challenge
Roxroy
@roxroy
Mar 11 2017 04:24
@MathematicsCoding , so % finds the modulus which is remainder left when dividing something
JAY PRAKASH THAKUR
@jay-thakur
Mar 11 2017 04:25
hi, I am doing "Quoting Strings with Single Quotes" . what is the mistake here? var myStr = "<a href='http://www.example.com' target='_blank'>Link</a>";
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:25
I know how remainder works...
Got it thanks
^^
Roxroy
@roxroy
Mar 11 2017 04:26
@MathematicsCoding , so what don't you understand about the challenge?
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:26
None...
I moved on..
I mean I was reviewing JS like starting over
Still I dont get this challenge "Convert Celsius to Fahrenheit"
Roxroy
@roxroy
Mar 11 2017 04:28
@jay-thakur , try switching " with ' for it to work
Kamal
@kpbro
Mar 11 2017 04:29
@jay-thakur replace starting and ending double quotes to single and all inner single quotes to double
@jay-thakur the challenge says: you should have 1 single quotes pair and 2 double quotes pair
Austin Wiggins
@austinwiggins
Mar 11 2017 04:33
Hi guys...
I am on Accessing objects properties with the dot operator

var testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};

// Only change code below this line

var hatValue = testObj;
var shirtValue = testObj;

I am supposed to change the two lines of code on the bottom
iandelible
@iandelible
Mar 11 2017 04:34
@austinwiggins yes, check the example, it should help
Austin Wiggins
@austinwiggins
Mar 11 2017 04:34
How do I get var hatValue = testObj to equal the object property hat?
Otis Vinston
@Ovinston
Mar 11 2017 04:34
i didn't know a question mark and a colon were shorthand for "if/else" till researching the card counting problem!!
Kamal
@kpbro
Mar 11 2017 04:35
hatValue = testObject.hat
Austin Wiggins
@austinwiggins
Mar 11 2017 04:35
@iandelible Thanks I didn't understand it. I looked it up tho and now I do
CamperBot
@camperbot
Mar 11 2017 04:35
austinwiggins sends brownie points to @iandelible :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @iandelible |http://www.freecodecamp.com/iandelible
JAY PRAKASH THAKUR
@jay-thakur
Mar 11 2017 04:36
@roxroy @kpbro thanks. got it.
CamperBot
@camperbot
Mar 11 2017 04:36
jay-thakur sends brownie points to @roxroy and @kpbro :sparkles: :thumbsup: :sparkles:
:cookie: 378 | @roxroy |http://www.freecodecamp.com/roxroy
:cookie: 234 | @kpbro |http://www.freecodecamp.com/kpbro
Ciuleafarul
@Ciuleafarul
Mar 11 2017 04:41
gj @roxroy
Roxroy
@roxroy
Mar 11 2017 04:44
@Ciuleafarul , what is up?
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:45
What up?
jay-thakur sends brownie points to @roxroy and @kpbro :sparkles: :thumbsup: :sparkles:
:cookie: 5000 | @kpbro |http://www.freecodecamp.com/kpbro
Lol
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:46
:cookie: 2637626734837 | @Mathematics |[http://www.freecodecamp.com/Mathematics]
Ciuleafarul
@Ciuleafarul
Mar 11 2017 04:47
hei, i got a problem with this one
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:47
@Ciuleafarul Same here...
Brad
@bradicalone
Mar 11 2017 04:47
hey ladies and gents
Ciuleafarul
@Ciuleafarul
Mar 11 2017 04:47
it only return the last value
Brad
@bradicalone
Mar 11 2017 04:48
anyone get through "Convert Celsius to Fahrenheit"
could shoot me the answer.. not sure how they want me to write it
Roxroy
@roxroy
Mar 11 2017 04:48
@Ciuleafarul , try to use the formula, so that it can work with any degrees
T(°C) = (T(°F) - 32) × 5/9
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:49
  fahrenheit = 0* 9/5 + 32; 
  fahrenheit = -30* 9/5 +32;
  fahrenheit = -10* 9/5 + 32;
  fahrenheit = 20* 9/5 + 32;
  fahrenheit = 30 * 9/5 + 32;
Roxroy
@roxroy
Mar 11 2017 04:49
@bradicalone , to use this formula for the conversion T(°C) = (T(°F) - 32) × 5/9
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:49
That one written by @Ciuleafarul is good one
@Ciuleafarul Did you pass?
Roxroy
@roxroy
Mar 11 2017 04:52
@Ciuleafarul , the first 4 will be ignored, and the only the last one will stick. You need to use the celsius variable
Jose A. Mejia
@ariel035
Mar 11 2017 04:53
I am having a little trouble with Escape Sequences in Strings challenge.
Nataly C.
@cstpk
Mar 11 2017 04:53
@ariel035 what do you have so far?
Brad
@bradicalone
Mar 11 2017 04:53
@roxroy right that works but I think they want it answered different
"shrugs"
Ciuleafarul
@Ciuleafarul
Mar 11 2017 04:54
@roxroy not yet
Jose A. Mejia
@ariel035
Mar 11 2017 04:54
var myStr = "FirstLine\n\SecondLine\ \r ThirdLine\";
@natalyscosta
Roxroy
@roxroy
Mar 11 2017 04:54
@Ciuleafarul , you are close try
fahrenheit = (9/5 * celsius) + 32;
Jose A. Mejia
@ariel035
Mar 11 2017 04:55
I'm only missing myStr should have encoded text with the proper escape sequences and no spacing.
i don't know what they mean by that
Nataly C.
@cstpk
Mar 11 2017 04:55
@ariel035 there are some \ missing, and some spacing
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:55
@roxroy That formula doesn't works
Same thing like only last thing will stick

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = (9/5 * 0) + 32;
  fahrenheit = (9/5 * -30) + 32;

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

// Change the inputs below to test your code
convertToF(30);
Abrar Kh.
@abrar-kh
Mar 11 2017 04:57
Hey guys
Roxroy
@roxroy
Mar 11 2017 04:57
@MathematicsCoding , change
fahrenheit = (9/5 * 0) + 32; fahrenheit = (9/5 * -30) + 32;
to
fahrenheit = (9/5 * celsius) + 32;
CamperBot
@camperbot
Mar 11 2017 04:57
:bulb: to format code use backticks! ``` more info
Brad
@bradicalone
Mar 11 2017 04:57
ohhh that's how they want you to do it
Nataly C.
@cstpk
Mar 11 2017 04:57
@MathematicsCoding It's a function. It is supposed to take in arguments. Celsius, in this case. fahrenheit = celsius .....
no guys
lol
its a function
sugirigit
@sugirigit
Mar 11 2017 04:58
how do we get this? FirstLine
\SecondLine\
ThirdLine
Brad
@bradicalone
Mar 11 2017 04:59
I almost had it..
sugirigit
@sugirigit
Mar 11 2017 04:59
nevermind saw it in thread
Abrar Kh.
@abrar-kh
Mar 11 2017 04:59
I was working find Fibonacci Numbers through recursion and I made that Algorithm well and it was working fine
Saboor Malik
@MathematicsCoding
Mar 11 2017 04:59
@natalyscosta I dont get it...
Abrar Kh.
@abrar-kh
Mar 11 2017 05:00
soon when I run that algorithm on Freecodecamp editor
Roxroy
@roxroy
Mar 11 2017 05:00
@MathematicsCoding , you need to use the parameter that is passed in to your formula
Abrar Kh.
@abrar-kh
Mar 11 2017 05:00
the webpage always failed to it
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:00
fahrenheit = (9/5 * 0) + 32;
fahrenheit = (9/5 * -30) + 32;
fahrenheit = (9/5 * -10) + 32;
Like that?
Brad
@bradicalone
Mar 11 2017 05:01
fahrenheit = celsius * 9.5 + 32;
gets 2 of them.. but I can't do the rest
ohh
Ciuleafarul
@Ciuleafarul
Mar 11 2017 05:01
@roxroy still the same problem, return only the first and last result
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:01
fahrenheit = 0 * 9.5 + 32'?
Roxroy
@roxroy
Mar 11 2017 05:02
@MathematicsCoding , paste your full code. I think you are close and is just missing a bit.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:02
fahrenheit = 0 * 9.5 + 32;
  fahrenheit = 20 * 9.5 + 32;
I changed my code alot...
Ciuleafarul
@Ciuleafarul
Mar 11 2017 05:03
is 9/5 not 9.5 lol
Roxroy
@roxroy
Mar 11 2017 05:03
@MathematicsCoding, change it to
fahrenheit = (9/5 * celsius) + 32;
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:03
isn't it same thing :p
Abrar Kh.
@abrar-kh
Mar 11 2017 05:03

I was working find Fibonacci Numbers through recursion and I made that Algorithm well and it was working fine, but the moment I ran that code for the first time the editor got crashed everytime. I do tried to block JS specifically just so that I can reset the code but sadly it won't work. If I block JS on my browser it doesn't reset the code either.

Do you guys can suggest me anything?

Brad
@bradicalone
Mar 11 2017 05:04
9.5 and 9/5 same...
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:04
Yeah
Roxroy
@roxroy
Mar 11 2017 05:04
@Ciuleafarul , on is a decimal, 9.5 and the other is 9 divided by 5
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:04
Wait a minute...
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:04
can someone help me in the Profile Lookup Challenege?
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:04
9.5 and 9/5 isn't the same
Nataly C.
@cstpk
Mar 11 2017 05:04
@abrar-kh try a different browser
Ciuleafarul
@Ciuleafarul
Mar 11 2017 05:05
yea, wich is 1.8
Roxroy
@roxroy
Mar 11 2017 05:05
@MathematicsCoding , did it work?
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:05
With 9/5
Brad
@bradicalone
Mar 11 2017 05:05

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit = celsius * 9/5 + 32;

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

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

Saboor Malik
@MathematicsCoding
Mar 11 2017 05:05
But still last thing stick
Brad
@bradicalone
Mar 11 2017 05:05
is the answer
Abrar Kh.
@abrar-kh
Mar 11 2017 05:05
@natalyscosta let me try
Brad
@bradicalone
Mar 11 2017 05:05
finally figured it out
Roxroy
@roxroy
Mar 11 2017 05:05
@Ciuleafarul paste your full code. I think you are close and is just missing the last piece
Brad
@bradicalone
Mar 11 2017 05:05
I was wrong with the 9.5 & 9/5..
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:06
Yeah
Joseph
@revisualize
Mar 11 2017 05:06
@ajayrexluega Okay.
@ajayrexluega Can you post just the function?
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:06
how to paste snippet with background?
Roxroy
@roxroy
Mar 11 2017 05:06
@bradicalone , you are missing the brackets
(9/5 * celsius) + 32
Joseph
@revisualize
Mar 11 2017 05:06

@ajayrexluega
If you are posting code that is large, Please use Gist - https://gist.github.com/ then please paste the link here.
...
How to do code block format: ..... PLEASE try with a small block of code before you try to make a bigger one.
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:06
@revisualize thanks
CamperBot
@camperbot
Mar 11 2017 05:06
ajayrexluega sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3474 | @revisualize |http://www.freecodecamp.com/revisualize
Brad
@bradicalone
Mar 11 2017 05:06
it ran the code to work..
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:07

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = 0 * 9/5 + 32;
  fahrenheit = -30 * 9/5 + 32;
  fahrenheit = -10 * 9/5 + 32;
  fahrenheit = 20 * 9/5 + 32;
  fahrenheit = 30 * 9/5 + 32;
  // Only change code above this line
  return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:07
function lookUpProfile(firstName, prop){
// Only change code below this line
  for(var i = 0; i < contacts.length; i++){

    if(firstName === contacts[i].firstName) {

      if(contacts[i].hasOwnProperty(prop)) {
        var contactVal = contacts[i];
        return contactVal[prop];

      } else {

        return "No such property";

      }

    } else {

      return "No such contact";

    }
  }
// Only change code above this line
}
Joseph
@revisualize
Mar 11 2017 05:07
@ajayrexluega Okay.
@ajayrexluega Your for loop isn't actually looping.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:08
See my code...
Joseph
@revisualize
Mar 11 2017 05:08

@ajayrexluega

for ( ..... ) {
    if (evaluation) {
        return "truth";
    } else {
        return "lies";
    }
 }

This exact loop.. Does not loop. Because as we know:
The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.

Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:08
how? can't figure it out
ahh I see
@revisualize thanks!!!!!! :D
CamperBot
@camperbot
Mar 11 2017 05:08
ajayrexluega sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: ajayrexluega already gave revisualize points
Joseph
@revisualize
Mar 11 2017 05:08
@ajayrexluega Do you need all of your code inside of the for loop?
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:09
i just realized it
yes, i think
Joseph
@revisualize
Mar 11 2017 05:09
@roxroy Your comment about missing brackets is actually incorrect. PEMDAS
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:09
let me refactor, i'll be back
Joseph
@revisualize
Mar 11 2017 05:09
@ajayrexluega No you don't.
@ajayrexluega You just need to move 1 line of code then delete two lines of code.
Abrar Kh.
@abrar-kh
Mar 11 2017 05:10
@natalyscosta thanks for the suggestion :)
CamperBot
@camperbot
Mar 11 2017 05:10
:cookie: 303 | @natalyscosta |http://www.freecodecamp.com/natalyscosta
abrar-kh sends brownie points to @natalyscosta :sparkles: :thumbsup: :sparkles:
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:10

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = 0 * 9/5 + 32;
  fahrenheit = -30 * 9/5 + 32;
  fahrenheit = -10 * 9/5 + 32;
  fahrenheit = 20 * 9/5 + 32;
  fahrenheit = 30 * 9/5 + 32;
  // Only change code above this line
  return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);
convertToF(20);
convertToF(0);
convertToF(-10);
convertToF(-30);
Joseph
@revisualize
Mar 11 2017 05:10

@MathematicsCoding
There is the function declaration of function convertToF(celsius) { .. You have a function name of convertToF and a parameter of celsius
Parameters are used just like variables. So, inside of the function you can use celsius JUST like any other variable.
If I have this code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

So, when we make the function call of:

addThree(10);

You're calling the function addThree You're also passing a value 10 as an argument.
In the function declaration of function addThree (num) { You see that there is a parameter defined of num
When we do addThree(10) then the value of the parameter num is passed the argument value of ... 10
Then if you follow the code through.. result = num + 3; ... and we know the value of num is 10.
Therefore, if we follow through the function we end up with ... result = 10 + 3; then result = 13; then we return the result.

Cameron Ayler
@Cameron-Ayler
Mar 11 2017 05:13

Hey, I'm working on the "Profile Lookup" Challenge on FreeCodeCamp.

ICYDK: Essentially, I'm given a variable containing an array 'contacts' which are made up of keys and properties.
The function I'm supposed to implement is given 'firstName' and 'prop' as parameters., and the goal is to determine if a given first name exists in one of the 'contacts' arrays, and if so, does it have that property.
If that's the case, then I'm supposed to return that property.

If there's no name, then I'm supposed to return "No such
contact."

If there is such a contact, but it doesn't have the 'prop' given in the parameter, I'm to return "No such property".

function lookUpProfile(firstName, prop){
// Only change code below this line

if (contacts.hasOwnProperty(firstName)) {

for (var i = 0; i < contacts.length; ++i) { 
if (contacts[i].hasOwnProperty[firstName] && 
    contacts[i].hasOwnProperty[prop]) { 

  return contacts[i][prop]; 

}
}

return "No such property";

}

return "No such contact";

// Only change code above this line
}

Problem: It keeps only returning "No such contact.

Roxroy
@roxroy
Mar 11 2017 05:14
@revisualize , right . It is not necessary due to operator precedence
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:14
@roxroy still cant pass this challenge...
Joseph
@revisualize
Mar 11 2017 05:14
@MathematicsCoding Look:
  fahrenheit = 0 * 9/5 + 32; // fahr is now 32.
  fahrenheit = -30 * 9/5 + 32; // fahr gets overwritten and is now -22
  fahrenheit = -10 * 9/5 + 32; // fahr gets overwritten and is now 14
  fahrenheit = 20 * 9/5 + 32; // fahr gets overwritten and is now 68
  fahrenheit = 30 * 9/5 + 32; // fahr gets overwritten and is now 86
// then fahrenheit gets returned to the function caller.
@MathematicsCoding You need to use the parameter celsius
@MathematicsCoding Did you not read what I wrote?
Roxroy
@roxroy
Mar 11 2017 05:16
@MathematicsCoding , delete all pasted lines and change it to
fahrenheit = celsius * 9/5 + 32;
Joseph
@revisualize
Mar 11 2017 05:16
@roxroy Explain WHY that is the answer.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:17
@roxroy wtf
Roxroy
@roxroy
Mar 11 2017 05:17
@revisualize, actually, I have already explained it earlier. He may have missed it
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:17
It actually workd...
Joseph
@revisualize
Mar 11 2017 05:18
@MathematicsCoding Can you explain why that worked?
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:18
I thought Im supposed to put 0, -30, etc. instead of celsius....
Because of the parameter?
Joseph
@revisualize
Mar 11 2017 05:18
@roxroy You are doing someone a disservice by just giving them the answer.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:19
...
Joseph
@revisualize
Mar 11 2017 05:19
@MathematicsCoding Yes because of the parameter.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:19
Yeah
I kinda figured it out :p
Joseph
@revisualize
Mar 11 2017 05:19
@MathematicsCoding If you have a function...
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:19
Why do all the result want the values?
different nums
Roxroy
@roxroy
Mar 11 2017 05:20
@MathematicsCoding , the computer is going to do all the calculations for you. You just have to send in the parameter and setup the function
Joseph
@revisualize
Mar 11 2017 05:20

@MathematicsCoding If you have a function of:

function addThree (num) { }

And you do a function call

addThree(10)

What is the value of num?

Saboor Malik
@MathematicsCoding
Mar 11 2017 05:20
10?
Matthew
@IMDBLM
Mar 11 2017 05:20
I've been stuck on Lookup tables for quite a bit and I'm sooooo confused, mostly by the example vs. being told to make a table with a different name. Here's my totally broken code (I left it with two different tries for the table):

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

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

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

// Change this value to test
phoneticLookup("charlie");
Joseph
@revisualize
Mar 11 2017 05:21

@MathematicsCoding If you have a function of:

function addThree (num) { }

And you do a function call

addThree(42)

What is the value of num?

Saboor Malik
@MathematicsCoding
Mar 11 2017 05:21
42
Joseph
@revisualize
Mar 11 2017 05:21
@IMDBLM Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.

@MathematicsCoding If you have a function:

function hello(fName, uName) { }

What are the parameters?

Saboor Malik
@MathematicsCoding
Mar 11 2017 05:22
fName, uName?
Joseph
@revisualize
Mar 11 2017 05:22
@MathematicsCoding And hello("Joseph", "@revisualize"); What is the value of each parameter?
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:23
Joseph? I guess...
Jose A. Mejia
@ariel035
Mar 11 2017 05:23
still can't figure this out
var myStr = "FirstLine \n\SecondLine\ \rThirdLine";
Joseph
@revisualize
Mar 11 2017 05:23
@MathematicsCoding fName would be "Joseph" and uName would be "@revisualize"
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:23
Oh
Brad
@bradicalone
Mar 11 2017 05:23
@ariel035 I got this far
Joseph
@revisualize
Mar 11 2017 05:23
@ariel035 remove the spaces.
Brad
@bradicalone
Mar 11 2017 05:23
"FirstLine\\nSecondLine\\rThirdLine";
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:24
Ok that does explains clearly...
Thanks
Brad
@bradicalone
Mar 11 2017 05:24
but can't get the 1st question asked
Roxroy
@roxroy
Mar 11 2017 05:25
@revisualize, you came in mid way. But in my first response I explained the formula to the person
T(°F) = T(°C) × 9/5 + 32. Thanks for bring it up though.
CamperBot
@camperbot
Mar 11 2017 05:25
roxroy sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3475 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 11 2017 05:26
@roxroy Giving someone the formula doesn't really tell them what parameters are and why they should be using it.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:26
@roxroy * not x...
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:27
Hi @revisualize , in the Profile Lookup challenge. How to access firstName in the contacts array of object in the function that has parameter with firstName? does firstName in contacts array and firstName in the function parameter conflicts?
sorry, i think my english is bad :D
it's not my native language :3
Joseph
@revisualize
Mar 11 2017 05:27
@ajayrexluega No.
Jayrex Acilo
@ajayrexluega
Mar 11 2017 05:28
hmmm..
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:28
I didn't know what parameter meant so...
Joseph
@revisualize
Mar 11 2017 05:28
@ajayrexluega You already have the answer to your question.
Jose A. Mejia
@ariel035
Mar 11 2017 05:28
@revisualize removed the spaces still not able to answer the first "myStr should have encoded text with the proper escape sequences and no spacing."
Joseph
@revisualize
Mar 11 2017 05:28
@ajayrexluega I'm confused why you're asking your question.
@ariel035 What is your code now?
Jose A. Mejia
@ariel035
Mar 11 2017 05:29
myStr should have encoded text with the proper escape sequences and no spacing. @revisualize var myStr = "FirstLine\n\SecondLine\ \rThirdLine";
Joseph
@revisualize
Mar 11 2017 05:29
@ariel035 You still have a space.
@ariel035 You have a space right between the \\ and \r
Cameron Ayler
@Cameron-Ayler
Mar 11 2017 05:30

@revisualize

Yeah, I get the gist of it. I've broken it down dozens of times in head, and it makes sense to me. All the pieces seem to be there, at least.

The only other thing I can see is maybe I'd need a second for loop, but idk.

Joseph
@revisualize
Mar 11 2017 05:30
@Cameron-Ayler You only need 1 loop.
Daniel
@Dutchie1990
Mar 11 2017 05:30

// Setup
```function abTest(a, b) {
// Only change code below this line
if (a < 0) {
return "undefined";
}
if (b < 0) {
return "undefined";
}
else
// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(0,8);``` Guys what is wrong with this code? the assignment works well but it wont pass Challenge 198

Joseph
@revisualize
Mar 11 2017 05:31
@Dutchie1990 "undefined" is a string.
@Dutchie1990 undefined is a key word
Daniel
@Dutchie1990
Mar 11 2017 05:31
So i just change it to undefined instead of "undefined"
Joseph
@revisualize
Mar 11 2017 05:31
@Dutchie1990 Try it.
Daniel
@Dutchie1990
Mar 11 2017 05:32
@revisualize Another good tip :) thanks
CamperBot
@camperbot
Mar 11 2017 05:32
dutchie1990 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3476 | @revisualize |http://www.freecodecamp.com/revisualize
Jose A. Mejia
@ariel035
Mar 11 2017 05:32
@revisualize Thank you, I can't believe all this time it was a spacing issue. almost 2 hours spent lol.
CamperBot
@camperbot
Mar 11 2017 05:32
ariel035 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3477 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 11 2017 05:32
@Cameron-Ayler You actually have issues.

@Cameron-Ayler You wrote:

function lookUpProfile(firstName, prop){
// Only change code below this line
if (contacts.hasOwnProperty(firstName)) {

this will NEVER be true for this lesson.

@Cameron-Ayler Also .. you wrote this:

if (contacts[i].hasOwnProperty[firstName] &&

That will never be true either.

@Cameron-Ayler Also ... this: contacts[i].hasOwnProperty[prop]isn't how you write a .hasOwnProperty() ... you use ( )s ... not ... [ ]s ... Methods are function calls.
And when you correct that.. It could be true.
Phil Curran
@XLCM
Mar 11 2017 05:38
Howdy: can anyone help with the 'Slasher Flick' algorithm challenge?
Joseph
@revisualize
Mar 11 2017 05:39
@XLCM Sure. Whatcha got?
@XLCM I like the location by the way.
Phil Curran
@XLCM
Mar 11 2017 05:39
Lol...is my location Seattle, Madison, or Mt. Hood?
Joseph
@revisualize
Mar 11 2017 05:40
@XLCM It's listed as Seattle.
Brad
@bradicalone
Mar 11 2017 05:40
@ariel035 what was the final code that passed?
Phil Curran
@XLCM
Mar 11 2017 05:40
@revisualize : so I have this...

function slasher(arr, howMany) {
// it doesn't always pay to be first
arr = arr.slice(howMany, arr.length);
return arr;
}

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

Does this seem like it'll work? It does. but I'm not sure why.
Joseph
@revisualize
Mar 11 2017 05:41
@XLCM Run your code through www.pythontutor.com/javascript.html
@XLCM I'm in Seattle. BTW.
Phil Curran
@XLCM
Mar 11 2017 05:41
Ahh...I've seen this in a Coursera Python course...the step-through. Great resource; thanks!
Joseph
@revisualize
Mar 11 2017 05:42
@XLCM You can actually shorten that code.
Phil Curran
@XLCM
Mar 11 2017 05:42
@revisualize Yeah, I think I saw a post of yours somewhere on a FB page re: all of your activity. Good on you. Us n00bs appreciate it. ;)
thanks @revisualize
CamperBot
@camperbot
Mar 11 2017 05:42
xlcm sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3478 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 11 2017 05:43
@XLCM That code can just become a return statement.
Matthew
@IMDBLM
Mar 11 2017 05:43

@revisualize it's been 20 minutes and this still isn't making any sense.


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

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





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

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

I'm not understanding how to take that table and assign val, then result to it.

Joseph
@revisualize
Mar 11 2017 05:43
@IMDBLM Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.
Jose A. Mejia
@ariel035
Mar 11 2017 05:43
@bradicalone var myStr = "FirstLine\n\SecondLine\\rThirdLine"; basically I had extra spaces and had to remove them.
Joseph
@revisualize
Mar 11 2017 05:43
@IMDBLM How do you modify the variable result?
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:44
@revisualize thanks
CamperBot
@camperbot
Mar 11 2017 05:44
mathematicscoding sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3479 | @revisualize |http://www.freecodecamp.com/revisualize
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:44
:star2: 25653726 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 11 2017 05:45
@MathematicsCoding Yeah, I'd rather not have that many brownie points.
Saboor Malik
@MathematicsCoding
Mar 11 2017 05:45
:P
Phil Curran
@XLCM
Mar 11 2017 05:45
thanks @piq9117
CamperBot
@camperbot
Mar 11 2017 05:45
xlcm sends brownie points to @piq9117 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @piq9117 |http://www.freecodecamp.com/piq9117
Joseph
@revisualize
Mar 11 2017 05:45
I'd actually like to get a job doing development at some point.
Ken Aguilar
@piq9117
Mar 11 2017 05:46
just do dat leet fizz buzz you'll get a job. lol
Matthew
@IMDBLM
Mar 11 2017 05:46
@revisualize well I feel like I could just say result = xxx but I don't even think I've properly made the table find (val).
Joseph
@revisualize
Mar 11 2017 05:47
@IMDBLM That's the answer I was looking for.
Ken Aguilar
@piq9117
Mar 11 2017 05:47
@IMDBLM how would you access a value from an object?
Joseph
@revisualize
Mar 11 2017 05:47
@IMDBLM Next question.
@IMDBLM How do you access an object property value?
Matthew
@IMDBLM
Mar 11 2017 05:48
@revisualize Using a dot modifyer, I think 4 or 5 lessons back
Joseph
@revisualize
Mar 11 2017 05:49
@IMDBLM What if you need to access the object property value with a variable?
Matthew
@IMDBLM
Mar 11 2017 05:52
Why am I not getting this? In the examples for the dot modifyer it creates an additional 2 vars.
Joseph
@revisualize
Mar 11 2017 05:52
@IMDBLM Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
@IMDBLM You need to re-assign the variable result the the object property value of the object that you created lookup.
@IMDBLM You need to use the parameter of the function to access the object property value.
@IMDBLM Ergo, you'll need to use bracket notation because parameters are used inside of your function just like variables.
Matthew
@IMDBLM
Mar 11 2017 05:54
Ok. I'll get back at it. Thanks @revisualize
CamperBot
@camperbot
Mar 11 2017 05:54
imdblm sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3480 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 11 2017 05:55
@IMDBLM With this code: function phoneticLookup(val) { } you have a function declaration with a function name of phoneticLookup and a parameter val.
When you make the function call: phoneticLookup("charlie"); You are calling the function by name and passing the argument of "charlie" to the function parameter of val as a value
Jarod Guthrie
@jarodguthrie
Mar 11 2017 06:02

Hi guys can anyone help with the Nesting For Loops challenge?

This is what I have atm:

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < mulitplyAll.length; i++){
for (var j=0; i < multiplyAll[i].length; j++)

     }  

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Joseph
@revisualize
Mar 11 2017 06:04
@jarodguthrie So. You have: function multiplyAll(arr) { } you have a function declaration with the function name of multiplyAll and a single parameter of arr.
Mridul
@mridulmishra22
Mar 11 2017 06:04
Why its showing possibility of infinite loop. To me doesn't seems so:
Joseph
@revisualize
Mar 11 2017 06:04
@jarodguthrie When you do this: mulitplyAll.length; you're trying to get the .length of the function mulitplyAll and functions don't have .lengths
Joseph
@revisualize
Mar 11 2017 06:05
@jarodguthrie Do you know what does have a .length? ... An array
@mridulmishra22 That is an infinite loop
@mridulmishra22 At least it looks like it to me.
@mridulmishra22 yeah, I added the // no protect and it crashed my browser.
Pagnito
@Pagnito
Mar 11 2017 06:14

Ok so im doing var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber = 16; // Change this Line
var player = testObj[playerNumber]; // Change this Line

and i dont understand the point of it
wouldnt that just fck things up
with the variable names
i mean variable values
the 16
Madninja1
@Madninja1
Mar 11 2017 06:15
@Pagnito just a second i will help you
Pagnito
@Pagnito
Mar 11 2017 06:16
k, i get how to do it, i just feel like its something that can mess up the code if im assigning a var a number thats also key
Madninja1
@Madninja1
Mar 11 2017 06:17
@Pagnito you give a value to the variable and then you get this value in massive
like a key
Pagnito
@Pagnito
Mar 11 2017 06:20
so when i assign playerNumber =16, is it alrdy at that point assigned to montana?
Madninja1
@Madninja1
Mar 11 2017 06:21
@Pagnito no
Ken Aguilar
@piq9117
Mar 11 2017 06:21
its just a key
const obj = {key: value}
to get that value you have to use a key
Pagnito
@Pagnito
Mar 11 2017 06:22
i get that, but what im asking is when i assign playerNumber = 16, is playerNumber already holding value of montana?
Madninja1
@Madninja1
Mar 11 2017 06:22
@Pagnito тщ
no
Ken Aguilar
@piq9117
Mar 11 2017 06:22
so u get playerNumber that is 16
obj[playerNumber] you access obj with whatever playerNumber key is
Pagnito
@Pagnito
Mar 11 2017 06:24
so once i put playerNumber in [] it becomes a key?
Ken Aguilar
@piq9117
Mar 11 2017 06:24
yes
Pagnito
@Pagnito
Mar 11 2017 06:24
i see
@piq9117 thank you
CamperBot
@camperbot
Mar 11 2017 06:24
pagnito sends brownie points to @piq9117 :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @piq9117 |http://www.freecodecamp.com/piq9117
Pagnito
@Pagnito
Mar 11 2017 06:24
@Madninja1 thank you
CamperBot
@camperbot
Mar 11 2017 06:24
pagnito sends brownie points to @madninja1 :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @madninja1 |http://www.freecodecamp.com/madninja1
Ken Aguilar
@piq9117
Mar 11 2017 06:24
thats how you do bracket notation.. theres also dot notation
Pagnito
@Pagnito
Mar 11 2017 06:25
sweet sweet
Madninja1
@Madninja1
Mar 11 2017 06:25
@piq9117 do you know how to update my progress to do frontend tests again?
Joseph
@revisualize
Mar 11 2017 06:26
Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Ken Aguilar
@piq9117
Mar 11 2017 06:26
im sorry.. could you elaborate
Madninja1
@Madninja1
Mar 11 2017 06:28
never mind)
Physicallime570
@Physicallime570
Mar 11 2017 06:33

im stuck on challenge 261 check for palindromes here is my code so far im just looking for a point in the right direction.
//function palindrome(str) {
// remove all symbols//
var replace= str.replace(/[#_]/g,'');
// turn everything lowercase//
str.toLowerCase();
//check for palindrome

return true;
}

palindrome("eye");

Ken Aguilar
@piq9117
Mar 11 2017 06:35
// Setup
function phoneticLookup(val) {
  var result = "";
  // Only change code below this line
  var lookup = {
   "alpha": "Adams",
   "bravo": "Boston",
   "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank"
  };

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

// Change this value to test
phoneticLookup("charlie");
i'll do it like this cuz im hipster. lol
  const lookup = {
   "alpha": "Adams",
   "bravo": "Boston",
   "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank"
  };

const phoneticLookup = (obj, val) =>
  obj[val];

const result = (lookup, "charlie")
console.log(result)
Ken Aguilar
@piq9117
Mar 11 2017 06:41
@Physicallime570 lets try separating those functions
function palindrome(str) {
// remove all symbols//
var replace= str.replace(/[#_]/g,'');
// turn everything lowercase//
str.toLowerCase();
//check for palindrome
return true;
}
palindrome("eye");
const replace = str => str.replace(/[#_]/g, '');
const toLower = str => str.toLower();
const palindrome = str => 
  // is it a palindrome?
JuicyITer
@juicyiter
Mar 11 2017 06:50
hello guys, is my code a little complicated?
function palindrome(str) {
  // Good luck!

  str=str.replace(/\W+/g,"");
  str=str.replace("_","");
  str=str.toLowerCase();
  if(str.split("").reverse().join("")==str){
    return true;
  }
  return false;
}



palindrome("E-0e");
Jor
@joreyesl
Mar 11 2017 06:51
@Physicallime570 you are heading in the right direction. You will have to modify/add to the regex to remove all special characters besides #_ also remember .replace() and .toLowerCase() will return new strings and don't modify the original. You will need to make sure you are calling it on the correct reference.
JuicyITer
@juicyiter
Mar 11 2017 06:51
to ignore the punctuation.case,and spacing
easymax1069
@easymax1069
Mar 11 2017 06:52
hello all
wanna post a problem but not sure how to put it in code box here
Jor
@joreyesl
Mar 11 2017 06:53
@ethanman you could simplify it a bit.
  1. You can use chaining to reduce the need of reassignment.
  2. You can combine the replace and use a single regex.
  3. You can return the comparison directly without the need of an if
Sultan
@Sultan2790
Mar 11 2017 06:53
Hello Do you guys know some php ?
I am working on contact from in html and I am using php to submit the information from that from ! how to display the informtion on the php page
easymax1069
@easymax1069
Mar 11 2017 06:55
@joreyesl coul dyou help me out
Jor
@joreyesl
Mar 11 2017 06:55
@easymax1069 use ```
more info below
CamperBot
@camperbot
Mar 11 2017 06:55
:bulb: to format code use backticks! ``` more info
easymax1069
@easymax1069
Mar 11 2017 06:55
@joreyesl thanks
CamperBot
@camperbot
Mar 11 2017 06:55
easymax1069 sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 585 | @joreyesl |http://www.freecodecamp.com/joreyesl
easymax1069
@easymax1069
Mar 11 2017 07:01

i doing know what i'm doing wrong

//findMinMax.js

module.exports = { findMinMax : function(array_numbers){

var max = Math.max.apply(null,array_numbers);

  var min = Math.min.apply(null,array_numbers);

  if (min == max){
      return min;
  }
  else{
      return([min, max]);
  }


}};

i'm testing with this

//findMinMax-spec.js

var findMinMax = require("../findMinMax");


(function() {
  'use strict';

  describe('Min-Max Numbers in a List: ', function () {

    describe('Return the min and max number in the list in a new list follows `[min, max]`', function () {

      it('should return [1,4] for [1, 2, 3 , 4]', function () {
        expect(findMinMax([1, 2, 3, 4])).toEqual([1, 4]);
      });

      it('should return [4, 6] for [6, 4]', function () {
        expect(findMinMax([6, 4])).toEqual([4, 6]);
      });

      it('should return [2, 78] for [4, 66, 6, 44, 7, 78, 8, 68, 2]', function () {
        expect(findMinMax([4, 66, 6, 44, 7, 78, 8, 68, 2])).toEqual([2, 78]);
      });

    });

    describe('Return the number in the list in a new list follows `[min]` when the number is the min and max number in that list', function () {

      it('should return [4] for [4, 4, 4, 4]', function () {
        expect(findMinMax([4, 4, 4, 4])).toEqual([4]);
      });

    });

  });

})();

i keep getting

findMinMax is not a function

JuicyITer
@juicyiter
Mar 11 2017 07:03
@joreyesl but how to matct _
Physicallime570
@Physicallime570
Mar 11 2017 07:06
thanks @piq9117 and @joreyesl i was really stuck
CamperBot
@camperbot
Mar 11 2017 07:06
physicallime570 sends brownie points to @piq9117 and @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 586 | @joreyesl |http://www.freecodecamp.com/joreyesl
:cookie: 285 | @piq9117 |http://www.freecodecamp.com/piq9117
fijeko
@fijeko
Mar 11 2017 07:06
@easymax1069 you export object with findMixMax property and save it in variable findMixMax so you should call it like findMinMax.findMinMax()
easymax1069
@easymax1069
Mar 11 2017 07:07
Alright will check it ou
@fijeko thanks
CamperBot
@camperbot
Mar 11 2017 07:10
easymax1069 sends brownie points to @fijeko :sparkles: :thumbsup: :sparkles:
:cookie: 338 | @fijeko |http://www.freecodecamp.com/fijeko
Joseph
@revisualize
Mar 11 2017 07:10
@easymax1069 What is describe I haven't seen that before and I can't find it on MDN
Sultan
@Sultan2790
Mar 11 2017 07:11
How to make $_Post linked
easymax1069
@easymax1069
Mar 11 2017 07:11
it worked @fijeko
Joseph
@revisualize
Mar 11 2017 07:12
@Sultan2790 You're in FreeCodeCamp/HelpJavaScript asking about PHP?
Jor
@joreyesl
Mar 11 2017 07:14
@ethanman you can use a set [ ], or use the or | operator,
Ex: /[\W_]/g this creates a set of \W and _. Or /\W|_/g this matches \W or _
JuicyITer
@juicyiter
Mar 11 2017 07:14
its the best i can do: @joreyesl

function palindrome(str) {
  // Good luck!

  str=str.replace(/\W+/g,"").replace("_","").toLowerCase();

  return str.split("").reverse().join("")==str;

}


palindrome("E-02e");
ill try that now
it worked!
once i used ()
Jor
@joreyesl
Mar 11 2017 07:17
@ethanman :thumbsup:
JuicyITer
@juicyiter
Mar 11 2017 07:17
thanks man
Bryan Reese
@breese8009
Mar 11 2017 07:18
I got a good hard JS challenge if anyone wants to try it, it took me almost all evening to solve it...
Direction: Given a string, "countAllCharacters" returns an object where each key is a character in the given string. The value of each key should be how many times each character appeared in the given string.


function countAllCharacters(str) {

}
countAllCharacters("banana");
Joseph
@revisualize
Mar 11 2017 07:20
@breese8009 Do you have any other tests?
Bryan Reese
@breese8009
Mar 11 2017 07:20
var output = countAllCharacters('banana');
console.log(output); // --> {b: 1, a: 3, n: 2}
Joseph
@revisualize
Mar 11 2017 07:20
@breese8009 Do you have any other tests?
Bryan Reese
@breese8009
Mar 11 2017 07:21
@revisualize u want like a diff input?
Joseph
@revisualize
Mar 11 2017 07:21
@breese8009 Sure.
Bryan Reese
@breese8009
Mar 11 2017 07:21
any word
Joseph
@revisualize
Mar 11 2017 07:21
@breese8009 Okay. I'm going to get started now.
Bryan Reese
@breese8009
Mar 11 2017 07:21
@revisualize make sense?
its tricky dude, but u will prolly get it pretty quick
Joseph
@revisualize
Mar 11 2017 07:24
@breese8009
function countAllCharacters(str) {
    var result = { };
    for (let i = 0; i < str.length; i++) {
      if (result.hasOwnProperty(str[i])) {
        result[str[i]]++;
      } else {
        result[str[i]] = 1;
      }
    }
    return result;
}
countAllCharacters("banana");
3 minutes?
Bryan Reese
@breese8009
Mar 11 2017 07:26
jesus
thats my goal
i wanna be on that level
:(
Joseph
@revisualize
Mar 11 2017 07:27
@breese8009 Should I refactor it?
Bryan Reese
@breese8009
Mar 11 2017 07:27
@revisualize lets see it
Joseph
@revisualize
Mar 11 2017 07:30
@breese8009 should it just be done with A-Z, a-z characters?
Bryan Reese
@breese8009
Mar 11 2017 07:31
@revisualize nope, not case or symbol sensative in this
prep.hackreactor.com is where i get these challenges btw
Joseph
@revisualize
Mar 11 2017 07:31
@breese8009 Spaces?
Bryan Reese
@breese8009
Mar 11 2017 07:33
@revisualize nope, just an all lowercase word
no spaces
Joseph
@revisualize
Mar 11 2017 07:34
@breese8009 I'm thinking of something else. but, i have this currently:
function countAllCharacters(str) {
    var result = { };
    for (let i = 0; i < str.length; i++) {
      result[str[i]] = (result.hasOwnProperty(str[i])) ? result[str[i]]++ : result[str[i]] = 1;
    }
    return result;
}
countAllCharacters("banana");
Bryan Reese
@breese8009
Mar 11 2017 07:35
{ b: 1, a: 1, n: 1 }
was the output on that
Joseph
@revisualize
Mar 11 2017 07:38
I'm trying to fix it.
I fixed it.
I was being silly.
Parker St. Pierre
@ParkerSTP
Mar 11 2017 07:42
hi, I understand how to use global variables in JavaScript, but I am unsure as to what the use of them are. Can someone explain this to me?
MrityunjaiMishra
@MrityunjaiMishra
Mar 11 2017 07:46
i am having a problem with concatenating the strings

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr;
myStr = "This is the start." + "This is the end.";

this is my code
can u tell me whats wrong with it
Manish Giri
@Manish-Giri
Mar 11 2017 07:47
function countAllCharacters(str) {
    let myMap = new Map();
    str.split('').forEach(letter => {
      let val = myMap.has(letter) ? myMap.get(letter) + 1 : 1;
      myMap.set(letter, val); 
    });

  return myMap;
}
Joseph
@revisualize
Mar 11 2017 07:47
@Manish-Giri Too much work.
Manish Giri
@Manish-Giri
Mar 11 2017 07:47
still, using maps.
@revisualize
Ken Aguilar
@piq9117
Mar 11 2017 07:48
@Manish-Giri nice.. a lot cleaner
Manish Giri
@Manish-Giri
Mar 11 2017 07:48
:smile: ty @piq9117
CamperBot
@camperbot
Mar 11 2017 07:48
manish-giri sends brownie points to @piq9117 :sparkles: :thumbsup: :sparkles:
:cookie: 286 | @piq9117 |http://www.freecodecamp.com/piq9117
Brad
@bradicalone
Mar 11 2017 07:48
@MrityunjaiMishra
var myStr = "This is the start. " + "This is the end.";
missing a space between start. "
and it's var myStr
MrityunjaiMishra
@MrityunjaiMishra
Mar 11 2017 07:49
thnx @bradicalone
CamperBot
@camperbot
Mar 11 2017 07:49
mrityunjaimishra sends brownie points to @bradicalone :sparkles: :thumbsup: :sparkles:
:cookie: 142 | @bradicalone |http://www.freecodecamp.com/bradicalone
MrityunjaiMishra
@MrityunjaiMishra
Mar 11 2017 07:49
got it
Joseph
@revisualize
Mar 11 2017 07:49
@breese8009
function countAllCharacters(str) {
    var result = { };
    str.replace(/[^\s]/g, function(i) {
        result[i] = (result.hasOwnProperty(i)) ? result[i]+1 : 1; });
    return result;
}
countAllCharacters("banana");
Joni petriashvili
@Jonhnwhantcoding
Mar 11 2017 07:51
guys I can't figure out what the {total:0} means here?
function checkCashRegister(price, cash, cid) {
  var change=cas-price;
  // Here is your change, ma'am.

  var register=cid.reduce(function(acc,curr){
    acc.total += curr[1];
    acc[curr[0]] = curr[1];
    return acc;
  }, {total:0});

  return change;
}
Joseph
@revisualize
Mar 11 2017 07:52
@breese8009 Which lesson was that I want to tag it and add it to my github.
Brad
@bradicalone
Mar 11 2017 07:53
anybody get through lesson "Word Blanks"
?
Joseph
@revisualize
Mar 11 2017 07:54

@bradicalone Gist by revisualize / FreeCodeCamp - Word_Blanks.js
The function declaration was set up as... function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) giving the function name as wordBlanks and with four parameter of myNoun, myAdjective, myVerb and myAdverb.
There is more that I could go into (if you want I can) but, I'll sum it up with:
Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

Here's an example of this:

function hello(fName, uName) {
     return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

Ken Aguilar
@piq9117
Mar 11 2017 07:56
@Jonhnwhantcoding its the initial value
Parker St. Pierre
@ParkerSTP
Mar 11 2017 07:56
can someone help me I'm stuck on "Local Scope and Functions"
I cant tick off "No global myVar variable"
Brad
@bradicalone
Mar 11 2017 07:57
thanks! @revisualize
CamperBot
@camperbot
Mar 11 2017 07:57
bradicalone sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3481 | @revisualize |http://www.freecodecamp.com/revisualize
Manish Giri
@Manish-Giri
Mar 11 2017 08:00
@ParkerSTP your code?
Brad
@bradicalone
Mar 11 2017 08:01
@revisualize
in the function I got..

var result = "";
// Your code below this line
result = myAdjective + myNoun + myVerb + myAdverb;

// Your code above this line
return result;

Joseph
@revisualize
Mar 11 2017 08:02
@bradicalone ?
@bradicalone Dopeoplewritelikethis? Or do people write like this?
Brad
@bradicalone
Mar 11 2017 08:03
ohhhhh gotcha
Kolawole Olaoluwa
@KolaCode
Mar 11 2017 08:04

I need help with this change:

convertToF(0) should return a number
convertToF(-30) should return a value of -22
convertToF(-10) should return a value of 14
convertToF(0) should return a value of 32
convertToF(20) should return a value of 68
convertToF(30) should return a value of 86

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();

Ken Aguilar
@piq9117
Mar 11 2017 08:06
formula for celcius -> fahrenheit is Temp * 9/5 + 32
Kolawole Olaoluwa
@KolaCode
Mar 11 2017 08:07
I got the first and second but I can't seem to add the third to the list
Using same formular
Ken Aguilar
@piq9117
Mar 11 2017 08:08
okay.. can we see your code?
Kolawole Olaoluwa
@KolaCode
Mar 11 2017 08:11

fahrenheit = 0;
fahrenheit = -54 + 32;
fahrenheit = -18 + 32;

It checked the 1st result skipped the second and checked the third.

But I need all the get the three checked so that I can work on the next one.

Ken Aguilar
@piq9117
Mar 11 2017 08:12
could you write it in a function?
Kolawole Olaoluwa
@KolaCode
Mar 11 2017 08:13
No am a beginner
Joseph
@revisualize
Mar 11 2017 08:13

There is the function declaration of function convertToF(celsius) { .. You have a function name of convertToF and a parameter of celsius
Parameters are used just like variables. So, inside of the function you can use celsius JUST like any other variable.
If I have this code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

So, when we make the function call of:

addThree(10);

You're calling the function addThree You're also passing a value 10 as an argument.
In the function declaration of function addThree (num) { You see that there is a parameter defined of num
When we do addThree(10) then the value of the parameter num is passed the argument value of ... 10
Then if you follow the code through.. result = num + 3; ... and we know the value of num is 10.
Therefore, if we follow through the function we end up with ... result = 10 + 3; then result = 13; then we return the result.

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32

Kolawole Olaoluwa
@KolaCode
Mar 11 2017 08:15

Ok thanks

I will get back to you

Aseem
@fr3e4k
Mar 11 2017 08:44
‘''
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 08:52
im working on the pomodoro project. can anyone explain to me how exactly the setInterval function works?
Markus Kiili
@Masd925
Mar 11 2017 09:12
@thodorisanta Calls a function repeatedly with fixed delay between calls.
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 09:15
@Masd925 so in the pomodoro clock project what should i make this function do/
Pieter Stokkink
@forkerino
Mar 11 2017 09:23
@thodorisanta It can be used to change the clock every second, for example.
Klausaar
@Klausaar
Mar 11 2017 09:24
It says that it should output "Hi World" to the dev console. What am I doing wrong?

// Example
function ourReusableFunction() {
console.log("Heyya, World");
}

ourReusableFunction();

// Only change code below this line

function reusableFunction(){
console.log("Hi World!");
}

reusableFunction();

Pieter Stokkink
@forkerino
Mar 11 2017 09:25
@Klausaar you have an exclamation point!
Klausaar
@Klausaar
Mar 11 2017 09:26
OMg
Pieter Stokkink
@forkerino
Mar 11 2017 09:26
yeah
:point_up:
@Klausaar spelling is always the first thing to look at.
remember for future exercises.
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:28
It's morning here.... same with you I guess @forkerino :wave:
Pieter Stokkink
@forkerino
Mar 11 2017 09:30
@Lumexralph :crystal_ball:
hello
The man from the future has arrived!
Andreirk69
@Andreirk69
Mar 11 2017 09:32
Hi guys
Need help

We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence.

You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.


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

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

Ogundele Olumide
@Lumexralph
Mar 11 2017 09:32
@forkerino not for long... doing my laundry
Andreirk69
@Andreirk69
Mar 11 2017 09:32

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");

Pieter Stokkink
@forkerino
Mar 11 2017 09:33
@Lumexralph wow, you still do laundry in the future?!?!
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 09:33

im working on the pomodoro clock what should i do now :/

https://codepen.io/oshikurou/pen/zZogbx?editors=0011

Ogundele Olumide
@Lumexralph
Mar 11 2017 09:33
@Andreirk69 the idea is for you to form a sentence string with your parameters and assign it to result but remember to separate them with spaces
Pieter Stokkink
@forkerino
Mar 11 2017 09:34
@Andreirk69 you have to compose a sentence out of the four function parameters. Use spaces in between them and maybe some extra words to make it a proper sentence. Assign the whole thing to result
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:34
@forkerino yes.... we don't have one cloth for all purpose yet
Andreirk69
@Andreirk69
Mar 11 2017 09:34
Okay
Thanks
Pieter Stokkink
@forkerino
Mar 11 2017 09:34
@Lumexralph lol
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:35
@forkerino can that happen for real?
Pieter Stokkink
@forkerino
Mar 11 2017 09:35
@Lumexralph I guess we'll find out.
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:35
will we still be around by then :smirk:
Pieter Stokkink
@forkerino
Mar 11 2017 09:36
@Lumexralph there's one futurist that claims that if you make it to 2030, you'll never have to die.
I doubt it
@Lumexralph so tell me, what do you want to do when you will be a developer? What kind of things do you want to build?
I mean, you already are, but when you are paid for it
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:40
@forkerino 2 questions.... very interesting
Johnny
@JohnnyBizzel
Mar 11 2017 09:41

@thodorisanta how does the time count down?

  //START BUTTON
  $('#start').on('click', function(evt) {

    if(session===true){
      minutes = parseInt($('#parA').html());

    }
    else{
      minutes = parseInt($('#parB').html());

    }
  });

I don't see a call to the timing function here.

Ogundele Olumide
@Lumexralph
Mar 11 2017 09:41
@forkerino when am a developer.... i want to take advantage of that position to get to leadership positions that can help shape the future of my country
@forkerino what I'll build will be stuffs that solves problems in Education.. making it as affordable as possible, business solutions for SMEs
Johnny
@JohnnyBizzel
Mar 11 2017 09:45
@Lumexralph @forkerino Morning chaps.
Isn't being a leader separate to being a developer?
Pieter Stokkink
@forkerino
Mar 11 2017 09:45
@Lumexralph I like it! Big goals and giving back to where you came from.
@JohnnyBizzel good morning to you.
Johnny
@JohnnyBizzel
Mar 11 2017 09:46
Goedemorgen
Pieter Stokkink
@forkerino
Mar 11 2017 09:46
:)
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:46
@JohnnyBizzel are they ?
@JohnnyBizzel what if you're both?
Pieter Stokkink
@forkerino
Mar 11 2017 09:47
I think one can be a lead tech or a tech lead...!
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:48
@forkerino beyond that
Johnny
@JohnnyBizzel
Mar 11 2017 09:48

@Lumexralph I think so but you can lead a project with a development team. Not everyone can do this. A project leader can demonstrate leadership but that person doesn't have to be a developer.

Quite often a project will have a lead though.

Spyrantis Theodoros
@thodorisanta
Mar 11 2017 09:49
@JohnnyBizzel it doesnt. i dont know how the function that will be called later will work
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:49
@JohnnyBizzel i understand, was just responding to @forkerino questions... i see beyond the software development walls
Pieter Stokkink
@forkerino
Mar 11 2017 09:50
@thodorisanta a good idea is to start writing the function call as if it will work and then you know precisely what it should do.
Johnny
@JohnnyBizzel
Mar 11 2017 09:50
@Lumexralph For me a leader is a good communicator who listens as well as gives instructions. You can use these skills working on a collaborative project.
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:51
@JohnnyBizzel is that all there's to being a Software developer?
@forkerino what about you?
Johnny
@JohnnyBizzel
Mar 11 2017 09:52
@Lumexralph I was taking about being a leader which is what you said your goal was.
Being a developer has different skills in my opinion.
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:53
@JohnnyBizzel you're right
@JohnnyBizzel can i throw same question @forkerino asked to you?
Johnny
@JohnnyBizzel
Mar 11 2017 09:56
@Lumexralph But I hope you make it because we as developers are quite fortunate in that we can potentially help many people in many ways without too much effort (relatively speaking).
cai
@keller0
Mar 11 2017 09:56
May i ask a silly question? What the '
consonant clusters' contains? I'm doing the Pig Latin and I never heard of it...
Ogundele Olumide
@Lumexralph
Mar 11 2017 09:57
@JohnnyBizzel that's also true..... Don't worry about that I'll give my best to get it
thanks @JohnnyBizzel
CamperBot
@camperbot
Mar 11 2017 09:58
lumexralph sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1460 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Mar 11 2017 09:58
@Lumexralph And if you need help you know where to come! :D
@keller0 I never heard of it either but I still did the challenge!
Ogundele Olumide
@Lumexralph
Mar 11 2017 10:00
@JohnnyBizzel the help I'll be needing won't be FCC stuffs.... . so brace up when i come knocking
Johnny
@JohnnyBizzel
Mar 11 2017 10:00
ha ha
Ogundele Olumide
@Lumexralph
Mar 11 2017 10:00
lol
Johnny
@JohnnyBizzel
Mar 11 2017 10:01
@keller0 in the English language you have 5 vowels. aeiou
All other letters are consonants.
Manish Giri
@Manish-Giri
Mar 11 2017 10:03
@Lumexralph :wave:
Pieter Stokkink
@forkerino
Mar 11 2017 10:03
@Lumexralph I have an idea for a business in the industry I was working in before (the book business). It will make the lives of people working in that industry a lot easier (at least during business hours ;)) Surely not as lofty as aiding the education system, but then again, I think people in the place where I'm from are so overeducated they forgot that they are sentient beings. I'm still looking for a way to build something that I think will have a great influence on the world as a whole. I'm hoping I can contribute to avoiding environmental catastrophe.
Now, let me finish my stock chart app
:joy:
Johnny
@JohnnyBizzel
Mar 11 2017 10:05
:joy: Shall we buy shares in you?
Pieter Stokkink
@forkerino
Mar 11 2017 10:07
lol
Karthik Nallasivan
@furball514
Mar 11 2017 10:17
Hello world
Johnny
@JohnnyBizzel
Mar 11 2017 10:17
Word
Karthik Nallasivan
@furball514
Mar 11 2017 10:18
@camperbot hello world
Johnny
@JohnnyBizzel
Mar 11 2017 10:20
@furball514 'sup furball?
Karthik Nallasivan
@furball514
Mar 11 2017 10:23
@JohnnyBizzel sup Johnny
About @JohnnyBizzel
CamperBot
@camperbot
Mar 11 2017 10:23
:star2: 1460 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Joseph
@revisualize
Mar 11 2017 10:24
Damn I've been doing http://prep.hackreactor.com for the last 90 minutes.
I'm 21% complete.
Johnny
@JohnnyBizzel
Mar 11 2017 10:25
@revisualize Their front page logos are borked.
They need a web designer :P
klangsucht
@klangsucht
Mar 11 2017 10:29
how i have to think?

function lookUpProfile(firstName, prop){
// Only change code below this line

if (contacts.hasOwnProperty(firstName)) {

if (contacts[firstName].hasOwnProperty(prop)) {
  return contacts[prop];
}
else {
  return "No such property"
}

}
else {
return "No such contact";
}

// Only change code above this line
}

Joseph
@revisualize
Mar 11 2017 10:29
@klangsucht Your returning too early.

@klangsucht

for ( ..... ) {
    if (evaluation) {
        return "truth";
    } else {
        return "lies";
    }
 }

This exact loop.. Does not loop. Because as we know:
The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.

Johnny
@JohnnyBizzel
Mar 11 2017 10:29
@klangsucht this is the wrong test for firstName : if (contacts.hasOwnProperty(firstName)) {
Joseph
@revisualize
Mar 11 2017 10:29
That too.
Johnny
@JohnnyBizzel
Mar 11 2017 10:31
@klangsucht Try debugging with http://pythontutor.com/javascript.html#mode=edit
@revisualize Morning sir
Joseph
@revisualize
Mar 11 2017 10:32
@JohnnyBizzel I'm actually about to get my ass to bed.
Johnny
@JohnnyBizzel
Mar 11 2017 10:32
@revisualize Must be about 3 am?
Sleep well!
Joseph
@revisualize
Mar 11 2017 10:34
234am
:v:
klangsucht
@klangsucht
Mar 11 2017 10:36
@revisualize ok. i think im complete wrong. only for my steps: (1) i have to use a for loop (2) in this loop is a if question, where i check while firstName is in lookup and when yes it checks the existenz of the prop and give the prop back... otherwhile "No such ..." in the case
@JohnnyBizzel what is the write test for first name?
Johnny
@JohnnyBizzel
Mar 11 2017 10:37
@klangsucht if you know how to debug this is easy.
But if you just want the answer I can give it to you.
https://forum.freecodecamp.com/t/freecodecamp-challenge-guide-profile-lookup/18259
klangsucht
@klangsucht
Mar 11 2017 10:40
@JohnnyBizzel contacts undefined?
Johnny
@JohnnyBizzel
Mar 11 2017 10:42

@klangsucht

The function should look through the contacts list for the given firstName parameter.

using a for loop for example

Did you do: https://www.freecodecamp.com/challenges/accessing-objects-properties-with-bracket-notation ?
And https://www.freecodecamp.com/challenges/iterate-with-javascript-for-loops ?

klangsucht
@klangsucht
Mar 11 2017 10:44
@JohnnyBizzel thanks for the answer and for the forum link, i will try it with 3 hints. it gives me a structure. and i was not bad in my thinking. only uncertain. yes i did that ;-)
Johnny
@JohnnyBizzel
Mar 11 2017 10:45
@klangsucht Most people get stuck on this challenge. Even me!
klangsucht
@klangsucht
Mar 11 2017 10:46
@JohnnyBizzel good to hear :-)
Chanjung Kim
@chanjungkim
Mar 11 2017 11:19
Hello
I am doing Counting Cards
Could you give me some hints?
the0ffh
@the0ffh
Mar 11 2017 11:30
@chanjungkim Hi! What do you get so far?
@chanjungkim *what do you have
klangsucht
@klangsucht
Mar 11 2017 11:31
@chanjungkim what is you problem? have to know some detail to give some hints
sergo8
@sergo8
Mar 11 2017 11:39

Somebody know, what's wrong in this code below?
function palindrome(str) {
// Good luck!
var splitStr = [];
var reFirst = '';
var reSecond = /\s\d?\w?/gi;

str = str.replace(reSecond, '');
var newStr = str.toLowerCase();

splitStr = newStr.split(reFirst);
var reverseStr = splitStr.reverse();
reverseStr = reverseStr.join('');

for (var i = 0; i <= newStr.length; i++) {
if (newStr[i] === reverseStr[i]) {
return true;
}else{
return false;
}
}
}

heroiczero
@heroiczero
Mar 11 2017 11:43
@sergo8 has to exclude all non _alphanumeric only i think
Ghulam Shabir
@ghulamshabir
Mar 11 2017 11:44
@sergo8 try if(newStr === reverseStr) return true else false without loop
sergo8
@sergo8
Mar 11 2017 11:47
@heroiczero Ok, but actually I still don't understand how regular expressions are works :(
heroiczero
@heroiczero
Mar 11 2017 11:49
@sergo8 regexp usually used to identify certain patterns or letters or numbers to search in a given string https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
@sergo8 try to read though the special characters https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Special_characters_meaning_in_regular_expressions it helps with learning maybe do some searches on Regexp afterwards
sergo8
@sergo8
Mar 11 2017 11:50
var reSecond = /\s\d\w/gi;
When I use expression above, they don't work properly
Modiu B Ijaoye
@MBTIjaoye
Mar 11 2017 11:51
@chanjungkim You'll need to first us switch statement to count the value of each card, and then ++ or -- the value to the 'var count' , finally you use if statement for checking the value of the count and return "Bet" and else to return "Hold". Hope this will help a lil.
Pieter Stokkink
@forkerino
Mar 11 2017 11:55
@sergo8 that will look for a space (\s), followed by a digit (\d), followed by an alphanumeric character (\w). It will look through the whole string and find all instances (/g) and ignore case (/i)
@sergo8 so it would find something like " 1w" or " 99" (\w includes numbers).
sergo8
@sergo8
Mar 11 2017 12:07
@ghulamshabir but why without loop it doesn't works?
I mean that it works :) But what a difference?
I checking each character in loop, and when the character doesn't coincide I will get false.
the0ffh
@the0ffh
Mar 11 2017 12:15
@sergo8 check this out:
http://regular-expressions.info/
It's really nicely explained how regex works.
klangsucht
@klangsucht
Mar 11 2017 12:35
what is wrong at this code? have somebody some hints please?

var Bike = function() {

// Only change code below this line.

var gear = 0;

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

this.getGear = function() {
return gear;
};

};

ok i get it ;-)
james umali
@indefinite0212
Mar 11 2017 12:41
@klangsucht how did you get it?
klangsucht
@klangsucht
Mar 11 2017 12:44
@indefinite0212 gear = test and var gear without a value
Brandon Blackwell
@Radlerz1
Mar 11 2017 12:46
wherefore art thou. I am not getting what they mean by object keys? Can someone explain
klangsucht
@klangsucht
Mar 11 2017 12:47
@Radlerz1 which challenge?
james umali
@indefinite0212
Mar 11 2017 12:48
return gear=test? @klangsucht
Brandon Blackwell
@Radlerz1
Mar 11 2017 12:48
wherefore art thou challenge
klangsucht
@klangsucht
Mar 11 2017 12:51
@Radlerz1 sorry, i have no idea
Brandon Blackwell
@Radlerz1
Mar 11 2017 12:53
anyone in here no what Object.keys does exactly? I googled it but their explanations don't click for me
james umali
@indefinite0212
Mar 11 2017 12:54
@klangsucht you mean return gear =test
wonskytuner
@wonskytuner
Mar 11 2017 12:57
if(myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];
}
return "Not found";
}
if(myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];
}
return "Not Found";
Pieter Stokkink
@forkerino
Mar 11 2017 12:57

@Radlerz1 it returns an array of all the keys on the object.
So if your object is

var obj = {
  a: 1,
  b: 2,
  c: 3
}

Object.keys(obj); will return ["a", "b", "c"]

wonskytuner
@wonskytuner
Mar 11 2017 12:58
Hi guys, 1st doesnt work and 2nd does. For me they look exact same. Any ideas why?
Brandon Blackwell
@Radlerz1
Mar 11 2017 12:59
ok so when I use Object.keys(collection) it returns ["0", "1", "2"]. yet my array is whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Pieter Stokkink
@forkerino
Mar 11 2017 12:59
@Radlerz1 an array is an object with keys 0 through array.length -1
you can see that when you do array[0]
and so on
Brandon Blackwell
@Radlerz1
Mar 11 2017 13:00
ok I got it now :)
Pieter Stokkink
@forkerino
Mar 11 2017 13:01
good
klangsucht
@klangsucht
Mar 11 2017 13:01
@indefinite0212 no! here is my code:

var Bike = function() {

// Only change code below this line.

var gear;

this.setGear = function(test) {
gear = test;
};

this.getGear = function() {
return gear;
};

};

return gear is in the get gear method
setGear is only to set the gear to the value in the ()
getGear Method return the gear
Modiu B Ijaoye
@MBTIjaoye
Mar 11 2017 13:05
@the0ffh thanks that page is very useful
CamperBot
@camperbot
Mar 11 2017 13:05
mbtijaoye sends brownie points to @the0ffh :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @the0ffh |http://www.freecodecamp.com/the0ffh
Kuba Michalski
@kubami9
Mar 11 2017 13:07
Hello guys! Could you help me please, how to remove all non-alphanumeric characters from string?
Pieter Stokkink
@forkerino
Mar 11 2017 13:08
@wonskytuner no idea. They look the same
@kubami9 use a regex!
Modiu B Ijaoye
@MBTIjaoye
Mar 11 2017 13:09
@kubami9 \w : matches alphanumeric character including underscore.
wonskytuner
@wonskytuner
Mar 11 2017 13:09
@forkerino Cheers ,for me they look same too, dunno maybe its glitch.
Pieter Stokkink
@forkerino
Mar 11 2017 13:11
@wonskytuner spelling error: Not found vs Not Found
Modiu B Ijaoye
@MBTIjaoye
Mar 11 2017 13:12
@kubami9 If you like to read more about regex visit this site, http://www.regular-expressions.info/quickstart.html they have done a really good job explaining.
Kuba Michalski
@kubami9
Mar 11 2017 13:18
Ok, thank you so much guys!
ArhaanAhmad
@ArhaanAhmad
Mar 11 2017 13:24
hey guys can you help me with the 216 problem
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 13:28
so for the pomodoro clock. should i let setInterval on repeat for every 1 sec? i still didnt get the how i should use it
   var timer = setInterval(function() {
    }, 1000);
Pieter Stokkink
@forkerino
Mar 11 2017 13:31
@thodorisanta yes. Until you stop it with removeInterval()
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 13:35
@forkerino and what will the inside do meanwhile?
Taiwo Amao
@TaiwoAmao
Mar 11 2017 13:35
@Lumexralph Hello
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:37
Hi all. Do we have any regular expression gurus in the room?
Pieter Stokkink
@forkerino
Mar 11 2017 13:42
@thodorisanta show the time that is left and subtract 1 second.
Chaitya Shah
@Chaitya62
Mar 11 2017 13:43
Can anyone suggest a good search alternative to pouchDBquicksearch?
Database has to be pouchDB only I need just another alternative for search
Adel
@AdelMahjoub
Mar 11 2017 13:48
@RoniqueRicketts Hi, maybe you don't need a regular expression guru, what do you need ?
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:49
@AdelMahjoub lol I know i just need help. :smile:
regular expression.jpg
Adel
@AdelMahjoub
Mar 11 2017 13:53
@RoniqueRicketts what pattern it should match, can't see clearly in the image
Spyrantis Theodoros
@thodorisanta
Mar 11 2017 13:53
@forkerino how will i make it work as a clock tho? i mean how will i take the 25 minutes 25:00 and make it go to 24:59?
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:54
@AdelMahjoub
Change the regex ohRegex to match only 3 to 6 letter h's in the word "Oh no".
Chaitya Shah
@Chaitya62
Mar 11 2017 13:54
/O(h) {3,6}
Sorry wait.
/o(h) {1,6}.+o/i
This should work
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:56
@Chaitya62 unfortunately that didn't accept.
Chaitya Shah
@Chaitya62
Mar 11 2017 13:57
Uh what is the question exactly?
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:58
@RoniqueRicketts
Change the regex ohRegex to match only 3 to 6 letter h's in the word "Oh no".
Chaitya Shah
@Chaitya62
Mar 11 2017 13:59
Oh make that 1 3
OMAR HEGAZI
@OmarHegazi94
Mar 11 2017 13:59
hey guyz
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 13:59
@Chaitya62 I did that.
OMAR HEGAZI
@OmarHegazi94
Mar 11 2017 13:59
need help with profile lookup
Dan Couper
@DanCouper
Mar 11 2017 13:59
@thodorisanta Start at 25 * 60, then reduce by one every one of your intervals
John Deegan
@JohnDeegs
Mar 11 2017 14:00
@OmarHegazi94 Where are you stuck?
OMAR HEGAZI
@OmarHegazi94
Mar 11 2017 14:00

@JohnDeegs function lookUpProfile(firstName, prop){
// Only change code below this line
// var result = contacts[firstName][prop];
for(var i = 0; i < contacts.length; i++) {

if(contacts.hasOwnProperty(firstName) && contacts.hasOwnProperty(prop)) {
return i;
}

}
if(!contacts.hasOwnProperty(firstName)) {
// console.log("No such contact");
return "No such contact";
} else if(!contacts.hasOwnProperty(prop)) {
return "No such property";
}

// Only change code above this line
}

Spyrantis Theodoros
@thodorisanta
Mar 11 2017 14:00
@DanCouper umm can you be more specific :/
Chaitya Shah
@Chaitya62
Mar 11 2017 14:01
o(h) {1,6} .+o/i
Dan Couper
@DanCouper
Mar 11 2017 14:01
@thodorisanta You can divide by 60 to get minutes value from that, remainder (got using %) is seconds
Chaitya Shah
@Chaitya62
Mar 11 2017 14:01
o(h) {3,6} .+o/i try this
OMAR HEGAZI
@OmarHegazi94
Mar 11 2017 14:01
only no such contact is working
Chaitya Shah
@Chaitya62
Mar 11 2017 14:01
There is a space before.
OMAR HEGAZI
@OmarHegazi94
Mar 11 2017 14:02
need 2 know why ?
Chaitya Shah
@Chaitya62
Mar 11 2017 14:02
Before period
John Deegan
@JohnDeegs
Mar 11 2017 14:03
@OmarHegazi94 Look up the .some() method of JS first, it will help you here. https://www.w3schools.com/jsref/jsref_some.asp
Ronique Ricketts
@RoniqueRicketts
Mar 11 2017 14:26
@Chaitya62 I fixed it.
Ghulam Shabir
@ghulamshabir
Mar 11 2017 14:29
@sergo8 sorry for late reply, regarding your question about why it worked without the loop, you can make it work using loop if you return false for non matching characters and return true outside the loop
OGKevin
@OGKevin
Mar 11 2017 14:30
hello
mitron6
@mitron6
Mar 11 2017 14:50
@OGKevin hello
OGKevin
@OGKevin
Mar 11 2017 14:53
@ghulamshabir u here ?
Austin Wiggins
@austinwiggins
Mar 11 2017 14:54
Can some1 guide me through using objects for lookups?
OGKevin
@OGKevin
Mar 11 2017 15:01
@austinwiggins sure
let me get the chanllage in front of me
Austin Wiggins
@austinwiggins
Mar 11 2017 15:02
Oh sorry guys nevermind I just figured it out...
OGKevin
@OGKevin
Mar 11 2017 15:02
ok np
Austin Wiggins
@austinwiggins
Mar 11 2017 15:02
Thank you for your willingness to help though @OGKevin ! ;)
CamperBot
@camperbot
Mar 11 2017 15:02
austinwiggins sends brownie points to @ogkevin :sparkles: :thumbsup: :sparkles:
:cookie: 305 | @ogkevin |http://www.freecodecamp.com/ogkevin
nitinol
@nitinol
Mar 11 2017 15:02
hello everyone
OGKevin
@OGKevin
Mar 11 2017 15:03
@nitinol :wave:
nitinol
@nitinol
Mar 11 2017 15:03
im stuck with using camel case decleration and i dont underdtand that what does "studlycapwar should use the camel case in both decleration" can u please help?
mitron6
@mitron6
Mar 11 2017 15:03
@austinwiggins What kind of help do you need?
OGKevin
@OGKevin
Mar 11 2017 15:03
@nitinol whats the channlage name ?
mitron6
@mitron6
Mar 11 2017 15:04
@nitinol Do you know what camel case is?
nitinol
@nitinol
Mar 11 2017 15:04
Understanding Case Sensitivity in Variables @OGKevin
Understanding Case Sensitivity in Variables @mitron6
thanks guys
OGKevin
@OGKevin
Mar 11 2017 15:04
@nitinol and waht have you codded so far ?
nitinol
@nitinol
Mar 11 2017 15:05
well ill show you
Anand Potukuchi
@anandpotukchi
Mar 11 2017 15:05
guys what is falsy bouncer?
nitinol
@nitinol
Mar 11 2017 15:05

// Declarations
var studlyCapVar = 10;
var properCamelCase = "A String";
var titleCaseOver = 9000;

// Assignments
var camelCase = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

here is my code
Anand Potukuchi
@anandpotukchi
Mar 11 2017 15:05
can anyone tell me what to do?
OGKevin
@OGKevin
Mar 11 2017 15:06
@nitinol ok i see u habe not done anything yet, waht dont you understand ?
mitron6
@mitron6
Mar 11 2017 15:06
@nitinol So modify the variable to use camel case. It might be hard if you don't recognize the words.
Anand Potukuchi
@anandpotukchi
Mar 11 2017 15:06
basic algos -> falsy bouncer
mitron6
@mitron6
Mar 11 2017 15:06
@nitinol The Assignments are wrong. The Declarations are correct.
Austin Wiggins
@austinwiggins
Mar 11 2017 15:07
@mitron I figured it out. :)
mitron6
@mitron6
Mar 11 2017 15:07
@austinwiggins congrats
nitinol
@nitinol
Mar 11 2017 15:07
the point i dont understood that: "studlyCapVar should use camelCase in both declaration and assignment sections." @OGKevin @mitron6
Anand Potukuchi
@anandpotukchi
Mar 11 2017 15:07
hey can someone please adress my problem
Hughy
@HMDuDe
Mar 11 2017 15:07

How do you reverse a string ? I've got a function that has to reverse whatever string it is given but I don't know what code to enter into the function. The code is:
function reverseString(str) {
var array = [];
array.push(str);
return array.reverse();

}

reverseString("hello");

nitinol
@nitinol
Mar 11 2017 15:08
i mean how to use?
mitron6
@mitron6
Mar 11 2017 15:08
@nitinol It is already using camel case in the Declarations. Those are the three lines after the line // Declarations.
OGKevin
@OGKevin
Mar 11 2017 15:09
@nitinol do you know/understand what camelCase means Write variable names in Javascript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.
what they are asking you to do is camelCase the declarations and the assignments