eliecerthoms
@eliecerthoms
Feb 14 2016 00:01 UTC
@dcnr how can i know about the methods that return something?
greg
@wearenotgroot
Feb 14 2016 00:02 UTC
@its-swats made your code work
@its-swats just say the word so i'll i can send you the version on pm
Shawn Watson
@its-swats
Feb 14 2016 00:04 UTC
The one I made works and passes all the tests, but I'd love to see another version of it. Thank you!
Norman Dela Cruz
@dcnr
Feb 14 2016 00:05 UTC
@eliecerthoms You could always check documents :D
@its-swats hi version of what?
greg
@wearenotgroot
Feb 14 2016 00:07 UTC
@its-swats check your pm :smile:
Norman Dela Cruz
@dcnr
Feb 14 2016 00:07 UTC
@its-swats oh Caesar's? You can check other people's solutions! http://www.freecodecamp.com/<username here> for example my link would be http://www.freecodecamp.com/dcnr
@its-swats or http://www.freecodecamp.com/wearenotgroot for @wearenotgroot
Mafalda
@otmeek
Feb 14 2016 00:08 UTC
I am on No repeats please and I'm getting an error Uncaught RangeError: Maximum call stack size exceeded
Norman Dela Cruz
@dcnr
Feb 14 2016 00:09 UTC
@wearenotgroot I checked your Caesar's, you could have used forEach instead :P
greg
@wearenotgroot
Feb 14 2016 00:09 UTC
@otmeek copy pasta them codes
Mafalda
@otmeek
Feb 14 2016 00:09 UTC
function permAlone(str) {

  function toggleLetters(arr, a, b) {
    var temporary = arr[a];
    a = b;
    b = temporary;
    return arr.join('');
  }

  function findPermutations(str, index, arr) {
    if(typeof str == "string") {
      str = str.split('');
    }
    if(typeof index == "undefined") {
      index = 0;
    }
    if(typeof arr == "undefined") {
      arr = [];
    }
    for(var i = index; i < str.length; i++) {
      arr.push(toggleLetters(str, index, i));
    }
    return findPermutations(str, index + 1, arr);
  }

  var a = findPermutations(str);
  console.log(a);

  return str;
}
greg
@wearenotgroot
Feb 14 2016 00:09 UTC
@dcnr like to be different :smile:
Mafalda
@otmeek
Feb 14 2016 00:09 UTC
I have a feeling something's bad about my recursive function
I'm pretty bad with recursive things
Norman Dela Cruz
@dcnr
Feb 14 2016 00:10 UTC
@otmeek you should properly define your base case, at a glance, I don't even know when your findPermutations will stop :P
Mafalda
@otmeek
Feb 14 2016 00:12 UTC
@dcnr right, I need to find out how to stop it lol
Cameron Bass
@cameronbass
Feb 14 2016 00:12 UTC
function reverseString(str) {
   str.Array.split.reverse.join();
  return str;
}

reverseString("hello");
What am I doing wrong?
greg
@wearenotgroot
Feb 14 2016 00:12 UTC
@cameronbass remove the Array
@cameronbass and .split() is a method
Norman Dela Cruz
@dcnr
Feb 14 2016 00:12 UTC
@otmeek yeah for example this stops when num <= 1
function factorialize(num, acc) {
  acc = acc || 1;

  return num <= 1 ? acc : factorialize(num - 1, acc * num);
}
@otmeek you should clearly define yours
Moisés Man
@moigithub
Feb 14 2016 00:13 UTC
missing parenthesis
no Array
Cameron Bass
@cameronbass
Feb 14 2016 00:13 UTC
Thank You! @wearenotgroot
CamperBot
@camperbot
Feb 14 2016 00:13 UTC
cameronbass sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
greg
@wearenotgroot
Feb 14 2016 00:13 UTC
@cameronbass so does .reverse()
CamperBot
@camperbot
Feb 14 2016 00:13 UTC
:star: 831 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
greg
@wearenotgroot
Feb 14 2016 00:14 UTC
@cameronbass remember method needs parenthesis
Mafalda
@otmeek
Feb 14 2016 00:15 UTC
@dcnr so I just need a condition that will make it stop
greg
@wearenotgroot
Feb 14 2016 00:15 UTC
@otmeek yes otherwise it will go on for ever :smile:
Mafalda
@otmeek
Feb 14 2016 00:16 UTC
@wearenotgroot for now, is there a way to make my code run at all step by step to debug without triggering the error?
Michael Mazzone
@GitMazzone
Feb 14 2016 00:17 UTC
@dcnr @preetamkajalrout Hey guys... still stuck on this problem. I restarted and I'm trying a new approach, but it's still not removing values. Any idea what I'm doing wrong now?
function destroyer(arr) {
  //Variable to hold elements meant to be removed from arr
  var toRemove = arguments.shift;

  //Should? filter through the array and return values that
  //aren't found to equal anything in the arr
  var destroyed = arguments[0].filter(function(val) {
    if(arr.indexOf(1, toRemove) <= 0) {
      return val;
    } 
  });

  return destroyed;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Moisés Man
@moigithub
Feb 14 2016 00:21 UTC
@GitMazzone check indexOf documentation... :)
wrong syntax
Zerka1982
@Zerka1982
Feb 14 2016 00:22 UTC
@moigithub I still can't fix the mobile version :/
greg
@wearenotgroot
Feb 14 2016 00:24 UTC
@otmeek if you had an ide you could do step by step to see the result
Moisés Man
@moigithub
Feb 14 2016 00:26 UTC
arguments is a special object who behave like an array.. but ITS NOT an array... so probably it dont have a shift method.. (also since its a method u need a set of parenthesis at the end )
so to make sure.. is better make a new copy
var toRemove = [].slice.call(arguments,1); //<--- copy the array but starting from index 1.. so its like u doin shift()
@GitMazzone
Zerka1982
@Zerka1982
Feb 14 2016 00:28 UTC
bon
Moisés Man
@moigithub
Feb 14 2016 00:29 UTC
u only returning val(which if positive can be evaluate as true) if it meet the condition.. but what if not ?
Norman Dela Cruz
@dcnr
Feb 14 2016 00:32 UTC
@wearenotgroot your .shift is missing the () too
also it's better to properly copy the array than slicing it https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/js-arguments#optimization-issues-with-arrayslice
@wearenotgroot wtf this mention autocomplete
@GitMazzone was meant for you
greg
@wearenotgroot
Feb 14 2016 00:33 UTC
@dcnr haha
Norman Dela Cruz
@dcnr
Feb 14 2016 00:34 UTC
@wearenotgroot lol man I'm so used to @+tab :( but I keep forgetting that the top one is usually the last poster
actually, seems like it's in the order of last posting!
barring self and duplicates
Mafalda
@otmeek
Feb 14 2016 00:35 UTC
is fcc down or did i break my browser with infinite loop
Shawn Watson
@its-swats
Feb 14 2016 00:35 UTC
@GitMazzone - yours is really close to what I ended up going with. your indexOf syntax needs to change a bit, I think. I can send you what i've got if you want to see something similar.
greg
@wearenotgroot
Feb 14 2016 00:36 UTC
@otmeek dont think you broke it
CamperBot
@camperbot
Feb 14 2016 00:36 UTC
wearenotgroot sends brownie points to @otmeek :sparkles: :thumbsup: :sparkles:
:star: 334 | @otmeek | http://www.freecodecamp.com/otmeek
Mafalda
@otmeek
Feb 14 2016 00:36 UTC
oh nvm
Norman Dela Cruz
@dcnr
Feb 14 2016 00:38 UTC
@otmeek did you come up with your own permutation function? I can't do that :( (or rather I didn't dedicate the time to learn the algo to make one :P)
Mafalda
@otmeek
Feb 14 2016 00:39 UTC
@dcnr I spent a ridiculous amount of time trying, but I ended up looking at several permutation functions written by other users in the end
I'm trying to switch letters around like these other functions do but mine aren't coming out that well ^^'
Priscila
@prilujan
Feb 14 2016 00:40 UTC
Hi, can someone help me in this lesson: Understanding Uninitialized Variables? Please, I'm stuck
Shawn Watson
@its-swats
Feb 14 2016 00:40 UTC
what are you stuck on?
Norman Dela Cruz
@dcnr
Feb 14 2016 00:41 UTC
@otmeek this worked great for me, even has pseudocode Heap's Algorithm
Mafalda
@otmeek
Feb 14 2016 00:43 UTC
@dcnr thanks for the link
CamperBot
@camperbot
Feb 14 2016 00:43 UTC
otmeek sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
:star: 622 | @dcnr | http://www.freecodecamp.com/dcnr
Mafalda
@otmeek
Feb 14 2016 00:44 UTC
I will try this without using recursion because it just made my browser crash moments ago lol
Norman Dela Cruz
@dcnr
Feb 14 2016 00:44 UTC
you're welcome, if you do use it though, just replace the output(A) pseudocode part with your sequence matching/counting code
Mafalda
@otmeek
Feb 14 2016 00:45 UTC
oh so that part stops the recursion
algorithms so confusing :(
Norman Dela Cruz
@dcnr
Feb 14 2016 00:46 UTC
yeah haha
@otmeek the method I used seems so inefficient though, I'd like to revisit this one sometime and redo it
Priscila
@prilujan
Feb 14 2016 00:53 UTC
// Initialize these three variables
var a; a = 5;
var b; b = 10;
var c; c = b + a;

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";
i don't understand how do to the var c
Shawn Watson
@its-swats
Feb 14 2016 00:56 UTC
so the lesson wants c to equal "I am a String!"
right now, c = c " " String!" would give you "15 String!"
so it looks like you need to make a change up in the "var c; c = b + a;" line
Jason Whisnant
@jwhisnant97
Feb 14 2016 00:57 UTC
I'm working on the Profile lookup project.
Is there someone who can look over this and tell me where I'm going wrong.
I've tried it 3 different ways and don't understand why it isn't working.
Shawn Watson
@its-swats
Feb 14 2016 00:58 UTC
sure, i'll take a look
Jason Whisnant
@jwhisnant97
Feb 14 2016 00:58 UTC
//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 lookUp(firstName, prop){
// Only change code below this line
  var errorMsg = '';

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

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

      if (contacts.hasOwnProperty(prop)){

        return contacts[i][prop];
    } else {
      errorMsg = 'No such property';
    }

   } else {
     errorMsg = 'No such contact';
   }

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

// Change these values to test your function
lookUp("Akira", "likes");
Moisés Man
@moigithub
Feb 14 2016 00:59 UTC
if (contacts.hasOwnProperty(prop)){
missing index