These are chat archives for FreeCodeCamp/HelpJavaScript

29th
Mar 2017
David Amanze
@GodKingShogun
Mar 29 2017 00:04
@JLuboff :wave:
i read an article called reduce made easy but it made reduce more complicated lol
Aaron Bell
@awb715
Mar 29 2017 00:09
@JLuboff do you use global variables in your calc prject?
mine is all global variables its bothering me
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:12

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  myObj.hasOwnProperty(checkProp);
  return  myObj.hasOwnProperty(checkProp);
}

// Test your code by modifying these values
checkObj("gift");
my stuck pls i need help
anyone

Tesing Object for Properties

chenshuqu
@chenshuqu
Mar 29 2017 00:13
@dav4thevid use "if" at beginning of your function.
David Amanze
@GodKingShogun
Mar 29 2017 00:13
i think i have hit a road block with the symmetric difference challenge :worried:
chenshuqu
@chenshuqu
Mar 29 2017 00:13
and return the match value
David Amanze
@GodKingShogun
Mar 29 2017 00:14
@dav4thevid what are you suppose to be doing
chenshuqu
@chenshuqu
Mar 29 2017 00:14
not the check result.
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:16
Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
@chenshuqu i should include if in front of my function.
@chenshuqu i did that earlier its giving all sorts of error message
Greg Duncan
@GregatGit
Mar 29 2017 00:18
@dav4thevid i think you are just returning true when you need to return the prop
Donnie
@Donnie-D
Mar 29 2017 00:19
is there something wrong in this?

//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
  var name="";
  var pro="";
    for(i=0;i<contacts.length;i++){
      if(firstName==contacts[i].firstName){
        if(contacts[i].hasOwnProperty(prop)===true){
          pro = contacts[i][prop];
        }
        else{
          pro="No such property";
        }
       name = contacts[i][firstName];
      }
      else{
        name="No such contact";
      }
    }
 return (name,pro);

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian","likes");
"Bob", "number" should return "No such contact" not fullfilling
Greg Duncan
@GregatGit
Mar 29 2017 00:20
@dav4thevid
  if myObj.hasOwnProperty(checkProp){
    // return the prop
  } else{
   // return something different
  }
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:20
@GregatGit return prop........i did just that......pls can u explain better
Greg Duncan
@GregatGit
Mar 29 2017 00:21
@dav4thevid you didn't return the prop - you just checked to see if it had the prop
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:21
oooooooooo i see
lemme retry...brb @GregatGit
chenshuqu
@chenshuqu
Mar 29 2017 00:25
@dav4thevid Function ".hasOwnProperty()" is just for judging, it can only returns ture or false.
it can only return true or false.
Greg Duncan
@GregatGit
Mar 29 2017 00:27
@Donnie-D you don't want it it keep loop once you have found the firstName - you should return there
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:27
@GregatGit still not passing
Greg Duncan
@GregatGit
Mar 29 2017 00:27
@dav4thevid show your code
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:27

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
   if myObj.hasOwnProperty(checkProp){};

  else {"Not Found"};
    return  myObj.hasOwnProperty(checkProp);
}



// Test your code by modifying these values
checkObj("gift");
yeah i understand that @chenshuqu
Donnie
@Donnie-D
Mar 29 2017 00:28
@GregatGit how do i break out of loop as you say please?
chenshuqu
@chenshuqu
Mar 29 2017 00:28
so you should find out how to index your array to get the correct value of "prop". I think you have already learned that....
Greg Duncan
@GregatGit
Mar 29 2017 00:29
@dav4thevid this needs to be in () so (myObj.hasOwnProperty(checkProp)) and a return stament in there returning the property
@Donnie-D with a return statement
@Donnie-D the first if statement in the loop should have no else linked to it
@dav4thevid if (myObj.hasOwnProperty(checkProp)){
Donnie
@Donnie-D
Mar 29 2017 00:33

```

//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
var name="";
var pro="";
for(i=0;i<contacts.length;i++){
if(firstName==contacts[i].firstName){
if(contacts[i].hasOwnProperty(prop)===true){
pro = contacts[i][prop];
}
else{
pro="No such property";
}
name = contacts[i][firstName];
}
name= "No such contact";
}
return (name,pro);

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian","likes");

Greg Duncan
@GregatGit
Mar 29 2017 00:34
@Donnie-D you need ``` on a seperate line on the bottom
Dana Aljirudi
@DanaJirudi
Mar 29 2017 00:34
Hey guys! I'm back with the same problem :worried: My code is not working when it's supposed to turn false (like in the example).. Any idea?
function mutation(arr) {
  var one = arr[0].toLowerCase;
  var two = arr[1].toLowerCase;
 for(var i = 0; i < two.length; i++){
   var holder = one.indexOf(two[i]);
   if(holder === -1){
   return false;
 }
 }
   return true;
}
mutation(["hello", "neo"]);
Donnie
@Donnie-D
Mar 29 2017 00:34
@GregatGit like this?

//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
  var name="";
  var pro="";
    for(i=0;i<contacts.length;i++){
      if(firstName==contacts[i].firstName){
        if(contacts[i].hasOwnProperty(prop)===true){
          pro = contacts[i][prop];
        }
        else{
          pro="No such property";
        }
       name = contacts[i][firstName];
      }
      name= "No such contact";
    }
 return (name,pro);

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian","likes");
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:35
hey can i get help
chenshuqu
@chenshuqu
Mar 29 2017 00:35
@Donnie-D the local varriable " i " at the for statement need to be declare.
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:35
I am stuck on the "Selecting from many options with Switch Statements" challenge
Greg Duncan
@GregatGit
Mar 29 2017 00:36
@Donnie-D pro = contacts[i][prop]; try return contacts[i][prop];
Roxroy
@roxroy
Mar 29 2017 00:36
@TJTheRandomCoder , can i see your code..
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:36

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

case val===1:

console.log("alpha");
break;

case val===2:

console.log("beta");
break;

case val===3:

console.log("gamma");
break;

case val===4:

console.log("delta");
break;

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

}

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

Donnie
@Donnie-D
Mar 29 2017 00:37
@GregatGit but the trouble is i have to make 2 returns from this function. dont i have to do them together?
Greg Duncan
@GregatGit
Mar 29 2017 00:37
@Donnie-D you can put as many returns as you want in a function - once it hits the return - end of function
Dana Aljirudi
@DanaJirudi
Mar 29 2017 00:37
Hey guys! I'm back with the same problem :worried: My code is not working when it's supposed to turn false (like in the example).. Any idea?
function mutation(arr) {
  var one = arr[0].toLowerCase;
  var two = arr[1].toLowerCase;
 for(var i = 0; i < two.length; i++){
   var holder = one.indexOf(two[i]);
   if(holder === -1){
   return false;
 }
 }
   return true;
}
mutation(["hello", "neo"]);
Donnie
@Donnie-D
Mar 29 2017 00:38
@GregatGit also am i right in creating variable name and pro to help with the work here?
Greg Duncan
@GregatGit
Mar 29 2017 00:38
@TJTheRandomCoder
switch(expression) {
    case n:
        code block
        break;
    case n:
        code block
        break;
    default:
        code block
}
Donnie
@Donnie-D
Mar 29 2017 00:39
@GregatGit i mean could i have done it without creating any extra variables?
Greg Duncan
@GregatGit
Mar 29 2017 00:39
@Donnie-D not needed
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:39
@GregatGit explain please?
Roxroy
@roxroy
Mar 29 2017 00:39
@TJTheRandomCoder , for your case statements you only need to put the value to match on , so
case val===1: would be case 1:
Greg Duncan
@GregatGit
Mar 29 2017 00:39
@TJTheRandomCoder that is how you do a switch https://www.w3schools.com/js/js_switch.asp
Donnie
@Donnie-D
Mar 29 2017 00:39
lol fellas we keeping @GregatGit well busy here :+1:
hekri-d
@hekri-d
Mar 29 2017 00:39
LOL. I always love "explain please". XD
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:39
@roxroy I edited that. Still doesn't work
@GregatGit thanks for the link
CamperBot
@camperbot
Mar 29 2017 00:39
tjtherandomcoder sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 841 | @gregatgit |http://www.freecodecamp.com/gregatgit
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:40

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
   if (myObj.hasOwnProperty(checkProp)){}

  return  myObj.hasOwnProperty(checkProp);
}



// Test your code by modifying these values
checkObj("gift");
Roxroy
@roxroy
Mar 29 2017 00:40
@TJTheRandomCoder ,did you change all of them.
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:40
@roxroy yep

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

case 1:

console.log("alpha");
break;

case 2:

console.log("beta");
break;

case 3:

console.log("gamma");
break;

case 4:

console.log("delta");
break;

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

}

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

Greg Duncan
@GregatGit
Mar 29 2017 00:41
@TJTheRandomCoder you don't need console.log
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:41
it might have to do with the variable but idk
Alex
@alexlo0319
Mar 29 2017 00:41
Hello, need help.
Roxroy
@roxroy
Mar 29 2017 00:41
@TJTheRandomCoder. good, let look at the next step
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:41
@GregatGit would the return be in between >> () also
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:41
@GregatGit so what would i use in this instance?
awatson0987
@awatson0987
Mar 29 2017 00:41
@roxroy make sure return is outside switch statement
Greg Duncan
@GregatGit
Mar 29 2017 00:41
a @TJTheRandomCoder answer = 'Gamma'
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:42
ohhhh! Makes sense now
thanks for the help @GregatGit
CamperBot
@camperbot
Mar 29 2017 00:42
tjtherandomcoder sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: tjtherandomcoder already gave gregatgit points
Greg Duncan
@GregatGit
Mar 29 2017 00:42
@dav4thevid now put a return statement in the {}
Roxroy
@roxroy
Mar 29 2017 00:43
@TJTheRandomCoder , set answer to the alpha, beta. etc answer = "alpha"; update the others as well
Greg Duncan
@GregatGit
Mar 29 2017 00:43
@dav4thevid this line return myObj.hasOwnProperty(checkProp); will return true or false - it won't give the value of the property
Tejinder Mann
@TJTheRandomCoder
Mar 29 2017 00:43
@roxroy I got it but thanks
CamperBot
@camperbot
Mar 29 2017 00:43
tjtherandomcoder sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:cookie: 490 | @roxroy |http://www.freecodecamp.com/roxroy
:bulb: to format code use backticks! ``` more info
Michał Szymański
@szaman76
Mar 29 2017 00:44
what am im doing wrogn
Greg Duncan
@GregatGit
Mar 29 2017 00:44
@szaman76 ``` not '''
CamperBot
@camperbot
Mar 29 2017 00:44
:bulb: to format code use backticks! ``` more info
hekri-d
@hekri-d
Mar 29 2017 00:44
@GregatGit LOL.
Michał Szymański
@szaman76
Mar 29 2017 00:44
function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return arr.unshift(); // Change this line
}
// Test Setup
var testArr = [1,2,3,4,5];
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Roxroy
@roxroy
Mar 29 2017 00:45
@TJTheRandomCoder , np .
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:49

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
   if (myObj.hasOwnProperty(checkProp)){return;}

myObj.hasOwnProperty("Not Found");
}



// Test your code by modifying these values
checkObj("gift");
silver537
@silver537
Mar 29 2017 00:50
@szaman76 just return arr.shift()
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 00:50
uve been helpful @GregatGit
@GregatGit buh its still not passing
Greg Duncan
@GregatGit
Mar 29 2017 00:51
@dav4thevid return the property - dont just write return
Michał Szymański
@szaman76
Mar 29 2017 00:51
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  arr.unshift();
  return arr.shift();  // Change this line
}
It worked
silver537
@silver537
Mar 29 2017 00:52
@szaman76 take away unshift, it's bad logic
because you dont NEED it
Donnie
@Donnie-D
Mar 29 2017 00:52
@GregatGit lol sorry mate I have dried up the code a little but still same error,,, me thicko

//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(i=0;i<contacts.length;i++){
      if(firstName==contacts[i].firstName){
        if(contacts[i].hasOwnProperty(prop)===true){
          return contacts[i][prop];
        }
        else
          return "No such property";

       return contacts[i][firstName];
     }}

// Only change code above this line

}

// Change these values to test your function
lookUpProfile("Kristian","likes");
Greg Duncan
@GregatGit
Mar 29 2017 00:52
@dav4thevid the last line should be something like return 'Not Found but check for typos - has to be exact
@Donnie-D
function lookUpProfile(firstName,prop){
// Only change code below this line

    for(i=0;i<contacts.length;i++){
      if(firstName==contacts[i].firstName){
        if(contacts[i].hasOwnProperty(prop)===true){
          return contacts[i][prop];
        }
        else
          return "No such property";

       return contacts[i][firstName]; // remove this line
     }}
// put a return statement here
// Only change code above this line

}
barki mustapha
@barkinet
Mar 29 2017 00:54
How can I copy my HTML from phone ?? Thank you
silver537
@silver537
Mar 29 2017 00:56
@barkinet i advise you to switch to desktop if you want the code to be formatted better, since the phone doesn't allow multi line messages.
idk why
Donnie
@Donnie-D
Mar 29 2017 00:56
@GregatGit superstar
Tzvetlin Velev
@tvelev92
Mar 29 2017 00:57
Anyone that knows about webpack and babel that can talk to me for a sec?
Alex
@alexlo0319
Mar 29 2017 01:00
Need help, I'll give you some cookies.
silver537
@silver537
Mar 29 2017 01:01
whats up
whats your problem
Alex
@alexlo0319
Mar 29 2017 01:02
are you talking to this guy <<<<<<
silver537
@silver537
Mar 29 2017 01:02
no
im talking to myself ;)
Alex
@alexlo0319
Mar 29 2017 01:02
Well tell yourself to help me lol
silver537
@silver537
Mar 29 2017 01:03
tell yourself to express your problem :)
Alex
@alexlo0319
Mar 29 2017 01:03
can you explain to me this?
function factorialize(num) {\
var factorial = 1;
for (var n = 2; n <= num; n++) {
factorial = factorial * n;
}
return factorial;
}
factorialize(5);
Alex Harrison
@alexharrison-js
Mar 29 2017 01:05
hello Friends
i’m trying to make a sweeet quote generator and I’m completely stuck at the last bit. I’ve got it all functioning except the twitter share button and I can’t figure out why window.open(…) does not open the twitter share link
silver537
@silver537
Mar 29 2017 01:06
@alexlo0319 the function takes in a number(num) and then loops num times multiplying all the numbers starting from 1 to num
Alex
@alexlo0319
Mar 29 2017 01:06
What's Var n =2;
silver537
@silver537
Mar 29 2017 01:07
that's a declaration to use in the for loop
Tzvetlin Velev
@tvelev92
Mar 29 2017 01:07
@alexlo0319 a variable set to the integer value 12
2*
Alex
@alexlo0319
Mar 29 2017 01:07
I thought so, just wanted to make sure bro.
Thanks @silver537
CamperBot
@camperbot
Mar 29 2017 01:07
alexlo0319 sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 906 | @silver537 |http://www.freecodecamp.com/silver537
silver537
@silver537
Mar 29 2017 01:08
for(declaration; conditional; increment)
Alex
@alexlo0319
Mar 29 2017 01:08
Oh yeah but why 2?
silver537
@silver537
Mar 29 2017 01:08
cause you set n= 2
Alex
@alexlo0319
Mar 29 2017 01:08
Is that by default?
silver537
@silver537
Mar 29 2017 01:09
no. you can set it however you want
you can even ignore the declaration
barki mustapha
@barkinet
Mar 29 2017 01:09

Build a #Tribute #Page by @barkinet

http://codepen.io/barki2017/pen/gmBvXa
Danny Welstad
@GoonTwo
Mar 29 2017 01:11
Bonfire Problem "Return Largest Number in Array": Anybody see whats wrong with this code? Or is there a better way to go about it? for the function call at the bottom I'm returning [5,5,5,5] is the largest vlaue of the first sub-array.

function largestOfFour(arr) {
  // You can do this!
  var array = [];
  var i = 0;
  arr.forEach(function(outerValues){
    var counter = 0;
    outerValues.forEach(function(innerValues){
      if (innerValues > counter) {
        counter = innerValues;
      }
    });
    while (i < arr.length) {
      array[i] = counter;
      i++;
    }
  });
  return array;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Gulsvi
@gulsvi
Mar 29 2017 01:11
@alexharrisonmusic newQuote and newAuthor are out of scope in your $('#share').on('click', function()
silver537
@silver537
Mar 29 2017 01:13
@GoonTwo get rid of the while loop
and instead, replace it with array.push(counter) which array you sohuld probably change to newArray since the name array for a variable can be confused
Danny Welstad
@GoonTwo
Mar 29 2017 01:16
@silver537 ok I got it to work. your suggestion is obviously cleaner and better, but what was going wrong with the while loop?
@silver537 and thanks btw!\
CamperBot
@camperbot
Mar 29 2017 01:18
goontwo sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 907 | @silver537 |http://www.freecodecamp.com/silver537
silver537
@silver537
Mar 29 2017 01:19
@GoonTwo im not really sure unless i debug it but it seems that array.length is already 0
so your conditional in your while loop is false since i is also equal 0
nvm
got that wrong
oh now i understand
Jeffrey
@jdale86
Mar 29 2017 01:20
hello, could someone please let me know when they have a moment to take a look a challenge for me?
Alex Harrison
@alexharrison-js
Mar 29 2017 01:20
@SkyCoder01 i thought that if i don’t declare var they would be global
how can I make them acceessible later
silver537
@silver537
Mar 29 2017 01:21
@GoonTwo the conditional in your while loop is checking the length of the original array, so basically, you are inputting 5 4 times, because there are 4 items in the original array.
and since youre also incrementing i, it becomes equal to the length of arr which makes the conditional false
so that's why you see [5,5,5,5]
Manish Giri
@Manish-Giri
Mar 29 2017 01:22
@jdale86 which challenge?
Jeffrey
@jdale86
Mar 29 2017 01:22

// Setup
function abTest(a, b) {
  // Only change code below this line


  // 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(2,2);

I am supposed to:

Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.

"Return Early Pattern for Functions" i believe its 185
Manish Giri
@Manish-Giri
Mar 29 2017 01:24
okay
did you have a question?
silver537
@silver537
Mar 29 2017 01:24
@GoonTwo if you would set i back to 0 at the beginning of the forEach then your output would be
[1001,1001,1001,1001]
Gulsvi
@gulsvi
Mar 29 2017 01:25
@alexharrisonmusic To make them "global" add this to the top of your script: var newQuote, newAuthor; and fix getElementByID - it should be getElementById. After that, you'll need to fix your twitter url to start with https://
Jeffrey
@jdale86
Mar 29 2017 01:25
so should i do this with if else? statements
Manish Giri
@Manish-Giri
Mar 29 2017 01:25
yes
Danny Welstad
@GoonTwo
Mar 29 2017 01:26
@silver537 oh gotcha. thanks for taking the time to explain that
CamperBot
@camperbot
Mar 29 2017 01:26
:warning: goontwo already gave silver537 points
goontwo sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Jeffrey
@jdale86
Mar 29 2017 01:26
okay because i just kind of came out of the blue
@Manish-Giri thanks
CamperBot
@camperbot
Mar 29 2017 01:26
jdale86 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4969 | @manish-giri |http://www.freecodecamp.com/manish-giri
Cale Switzer
@Tennyx
Mar 29 2017 01:30
Is there a way to get an input field value with jquery/ajax? I need to have an input field that, when I click a button, it sends whatever was typed in that input box to the server via ajax. Right now I'm just getting empty strings. Tried .val(), .html(), .serialize(). no luck
Gulsvi
@gulsvi
Mar 29 2017 01:31
@Tennyx .val() should work - if your <input> is in a form though, you'll have to use event.preventDefault when you submit the form to keep it from refreshing the page stackoverflow.com/questions/1263852/prevent-form-redirect-or-refresh-on-submit
Riadh
@KWFE
Mar 29 2017 01:31
hey guys
Cale Switzer
@Tennyx
Mar 29 2017 01:32
@SkyCoder01 it isn't in a form. So it should work?
Gulsvi
@gulsvi
Mar 29 2017 01:33
@Tennyx Yeah, as long as you have the right selector, .val() will tell you what's in that text field when you submit the text
sassy2807
@sassy2807
Mar 29 2017 01:35
So as I go through these challenges, I wonder if there is a way to see the result of your code. I get what it tells me to do but I never get to see what the result looks like (so it sinks in) Am I missing something or is this just how it is?
Cale Switzer
@Tennyx
Mar 29 2017 01:35
@SkyCoder01 Oh im an idiot, I had wrong id name. Thanks so helping me debug it!
barki mustapha
@barkinet
Mar 29 2017 01:36
<iframe src="//www.facebook.com/plugins/follow?href=https%3A%2F%2Fwww.facebook.com%2Fprofile.php%3Fid%3D100016040853947&layout=standard&show_faces=true&colorscheme=light&width=450&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
Alex
@alexlo0319
Mar 29 2017 01:36

What is this?

if (words[i].length > maxLength)

Gulsvi
@gulsvi
Mar 29 2017 01:36
lol, no problem, happy to help
Alex
@alexlo0319
Mar 29 2017 01:36
What's the [i]?
Gulsvi
@gulsvi
Mar 29 2017 01:38

@alexlo0319 i is a variable, for example:

var i = 0;
var word = 'hello'

then word[i] = word[0] = 'h'

or with words = ['hello', 'world'];
words[0].length is 5
Alex
@alexlo0319
Mar 29 2017 01:39
why with words ['hello', 'world']?
Bryan Reese
@breese8009
Mar 29 2017 01:40
trying to understand something ....can someone help explain this? var args = Array.prototype.slice.call(arguments);
Jai Mitch
@jaimitch
Mar 29 2017 01:40

when i put in the new line of code it it erases the previous. can anyone help me figure this out'''
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(0);
convertToF(-30);
convertToF(-10);
convertToF(20);
convertToF(30);'''

CamperBot
@camperbot
Mar 29 2017 01:40
:bulb: to format code use backticks! ``` more info
Joseph
@revisualize
Mar 29 2017 01:41
@jaimitch Sure.

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

Joseph
@revisualize
Mar 29 2017 01:44
@jaimitch So, from that .. you need to use celsius in you function just like you would use any other variable.
Jai Mitch
@jaimitch
Mar 29 2017 01:44
@revisualize great, thank you.
CamperBot
@camperbot
Mar 29 2017 01:44
jaimitch sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3613 | @revisualize |http://www.freecodecamp.com/revisualize
Gulsvi
@gulsvi
Mar 29 2017 01:45
@breese8009 It's a way to make an array like object an array. Same as doing Array.from(arguments)
function myFunc(args) {
  console.log(arguments) // { 0: [1,2,3], 1: [4,5,6] }
  console.log(Array.prototype.slice.call(arguments)) // [[1,2,3], [4,5,6]]
}

myFunc([1, 2, 3], [4, 5, 6]);
Cory Bowles
@cbconsulting
Mar 29 2017 01:53

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

}
}

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

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

Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
soo close
hoping someone can help out on this one
Aaron Fox
@aaronfox
Mar 29 2017 01:54
Hey, did anyone just cruise through FreeCodeCamp's curriculum with ease until they got to the "Advanced Algorithm Scripting" section? This is the first time I've gotten a little frustrated while doing FCC's curriculum...
Gulsvi
@gulsvi
Mar 29 2017 01:54
I hate these algorithms :p keep giving up
symmetric difference is just giving me a headache now.... I mean I could do it with a dozen for loops, but trying to write efficient code for these is not easy right now
Aaron Fox
@aaronfox
Mar 29 2017 01:56
@SkyCoder01 Same! That's what I'm trying to wrap my mind around right now and it's just not clicking right now... glad to hear I'm not the only one hahah
Joseph
@revisualize
Mar 29 2017 01:57
@truepalyer6 arr[i] & arr[j] what is this doing?
Cory Bowles
@cbconsulting
Mar 29 2017 01:57
@revisualize pulling a rabbit out my rear on that
i know it is wron
trying to figure out how to get prodcut to mulitpy the two
or should i try two seperate console.log statments
TanukiTom
@TanukiTom
Mar 29 2017 01:58
Trying to remove all numbers, spaces and punctuation from strings with "var string = str.replace(/[^\w]/gi, "");"; but don't think its removing "_"
Roxroy
@roxroy
Mar 29 2017 01:59
@TanukiTom , what part is not working ?
TanukiTom
@TanukiTom
Mar 29 2017 02:00
@Roxroy My code passes all but two checks: "palindrome("_eye") should return true" and "palindrome("0_0 (: /-\ :) 0-0") should return true."
@Roxroy It passes everything else. I think the problem is that line of code I posted maybe isn't removing "_", but I think it should be.
@Roxroy You want to see all the code? It isn't that long
c0d0er
@c0d0er
Mar 29 2017 02:04
@alpox thanks
CamperBot
@camperbot
Mar 29 2017 02:04
c0d0er sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 887 | @alpox |http://www.freecodecamp.com/alpox
TanukiTom
@TanukiTom
Mar 29 2017 02:04
'''function palindrome(str) {var string = str.replace(/[^\w]/gi,"");
var cleanString = string.toLowerCase();
var reverseCleanString = cleanString.split("").reverse().join("");
if (cleanString === reverseCleanString) {
return true;
} else {
return false;
}
}
CamperBot
@camperbot
Mar 29 2017 02:04
:bulb: to format code use backticks! ``` more info
TanukiTom
@TanukiTom
Mar 29 2017 02:05
Oops, sorry. Meant to format that
Joseph
@revisualize
Mar 29 2017 02:05
@TanukiTom What is ^\w ?
TanukiTom
@TanukiTom
Mar 29 2017 02:06
@Joseph I thought it meant non-letters.
@Joseph I could be wrong there, because my regex is a little rusty
Is there a regex symbol that just stands for all punctuation (such as ., !, %, etc.)?
Joseph
@revisualize
Mar 29 2017 02:08
Yes.
Greg Laux
@GRLaux
Mar 29 2017 02:09
var factor= "";
function factorialize(num) {
  for (i=0; i <= num; i++){
    factor = factor + i;
  }
  return factor;
}

factorialize(5);
this is what I'm working on for the second algorithm challenge
could anyone vaguely point me in the right direction?
Joseph
@revisualize
Mar 29 2017 02:09
@GRLaux You have a global variable. Global variables are NOT reset when the tests run.
TanukiTom
@TanukiTom
Mar 29 2017 02:09
@Joseph Do you know what it is b/c I can't find it.
Greg Laux
@GRLaux
Mar 29 2017 02:10
oooooooh
TanukiTom
@TanukiTom
Mar 29 2017 02:10
@Joseph /p ?
Joseph
@revisualize
Mar 29 2017 02:10
@TanukiTom I'm not @Joseph
That's someone else.
TanukiTom
@TanukiTom
Mar 29 2017 02:10
@revisualize Oh, sorry.
Greg Laux
@GRLaux
Mar 29 2017 02:11
@revisualize I took the global variable out and it returns "null." Should I maybe put the numbers into an array and add them together from that?
Joseph
@revisualize
Mar 29 2017 02:11
@GRLaux Well that was silly.
@GRLaux What happens when you take a string and add a number to it?
Greg Laux
@GRLaux
Mar 29 2017 02:13
ooooooooh!
Joseph
@revisualize
Mar 29 2017 02:13
@GRLaux You also deleted your variable. So, that's silly.
Tzvetlin Velev
@tvelev92
Mar 29 2017 02:13
Screen Shot 2017-03-28 at 7.13.03 PM.png
why is the second one disfunctional
only difference is the first one uses let
and second uses var
TanukiTom
@TanukiTom
Mar 29 2017 02:14
Okay, let run line of code by everybody. '''var string = str.replace(/[^a-zA-Z]/gi,"");
CamperBot
@camperbot
Mar 29 2017 02:14
:bulb: to format code use backticks! ``` more info
Joseph
@revisualize
Mar 29 2017 02:15
@TanukiTom You want to keep the numbers
Greg Laux
@GRLaux
Mar 29 2017 02:15
@revisualize thank you for the hints, I think I will work on it more :)
CamperBot
@camperbot
Mar 29 2017 02:15
grlaux sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3614 | @revisualize |http://www.freecodecamp.com/revisualize
TanukiTom
@TanukiTom
Mar 29 2017 02:15
@revisualize Oh...
Eman
@Eman16021
Mar 29 2017 02:16

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
fahrenheit = convertToF(0);

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
TanukiTom
@TanukiTom
Mar 29 2017 02:16
@revisualize Thanks. I did "var string = str.replace(/[^a-zA-Z0-9]/gi,"");" and it cleared.
CamperBot
@camperbot
Mar 29 2017 02:16
tanukitom sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3615 | @revisualize |http://www.freecodecamp.com/revisualize
Eman
@Eman16021
Mar 29 2017 02:16
first part is the code im given second is what i need to get
please help
idek where to begin
Riadh
@KWFE
Mar 29 2017 02:19
hi any js good coder here !
Eman
@Eman16021
Mar 29 2017 02:19
nope
struggling hard right now
Cory Bowles
@cbconsulting
Mar 29 2017 02:21

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

}
}

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

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

i would like to know why the console .log is actually doing in this soultion
i get the loops but what is that console.log actually doing to [i] &[j]
Ashish Inamdar
@Ashish-Inamdar
Mar 29 2017 02:22
Hi need some help here. Even though the code is camelcase i am not able to pass the case

// Declarations
var StudlyCapVaR;
var ProperCamelCase;
var TitleCaseOver;

// Assignments
StudlyCapVar = 10;
ProperCamelCase = "A String";
TitleCaseOver = 9000;

Joseph
@revisualize
Mar 29 2017 02:22
@truepalyer6 Don't console.log
@truepalyer6 I have no idea why you put it there.
Ashish Inamdar
@Ashish-Inamdar
Mar 29 2017 02:23
@revisualize Please have a look at my code also
Joseph
@revisualize
Mar 29 2017 02:23
@Ashish-Inamdar You're not doing camel case
Bruno Teófilo
@Heirian
Mar 29 2017 02:23

I have pass the test, but i dont know if my code it's really right.
Help me

var Bike = function(gear) {
this.gear = gear;
this.setGear = function(change) {
gear = change;
};
this.getGear = function() {
return gear;
};
};

Joseph
@revisualize
Mar 29 2017 02:23
@Ashish-Inamdar thisIsHowYouDoCamelCase
@Ashish-Inamdar Lowercase letter up front.
@Ashish-Inamdar You need to correct the top and the bottom.
Ashish Inamdar
@Ashish-Inamdar
Mar 29 2017 02:24
@revisualize Thanks
CamperBot
@camperbot
Mar 29 2017 02:24
ashish-inamdar sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3616 | @revisualize |http://www.freecodecamp.com/revisualize
Ashish Inamdar
@Ashish-Inamdar
Mar 29 2017 02:24
Got it
:)
FlashHero
@FlashHero
Mar 29 2017 02:24
$(document).ready(function () {
    $('.the-button').click(function () {
        $('#the-input').val($('#the-input').val() + $(this).text());
    });
    $('#equals').click(function () {
        var convertedToArr = $('#the-input').val().split('');
        if (convertedToArr.slice(-1) == '/', '*', '+', '-') {
            convertedToArr.pop();
            // there's an operator at the end
            $('#the-input').val(eval(convertedToArr.join('')));
        }
        else if (convertedToArr.slice(-1) != '/', '*', '+', '-') {
            // there's no operator at the end
            $('#the-input').val(eval(convertedToArr.join('')));
        }
    });
    $("#del").click(function () {
        $('#the-input').val('');
    });
});
I'm trying to delete the operator if there is at the end but when I put operator at the end it works but if i don't put an operator at the end then it doesn't work please help
Cory Bowles
@cbconsulting
Mar 29 2017 02:25
@revisualize still not tracking when i looked at other ways of approaching this problem when i console.log the solution it passed the criteria. What other way would you have choose besides the console.log
i would of used .reduce or flatten
Joseph
@revisualize
Mar 29 2017 02:25
@truepalyer6 No.
@truepalyer6 Could you use .reduce() yes.
Cory Bowles
@cbconsulting
Mar 29 2017 02:26
just dont know where else to put that .reduce()
Joseph
@revisualize
Mar 29 2017 02:26
Why?
Cory Bowles
@cbconsulting
Mar 29 2017 02:26
because i have a anerisim at the moment
Joseph
@revisualize
Mar 29 2017 02:26
@truepalyer6 just remove the console.log and leave the stuff in the console.log in your function at the same line.

@truepalyer6 this:

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

becomes

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < arr.length; i++) {
   for (var j=0; j < arr[i].length; j++) {
     product *= arr[i][j];
   }
}
// Only change code above this line
return product;
}
MAGIC
MarwanSultan
@MarwanSultan
Mar 29 2017 02:27
Can someone please help me?
Cory Bowles
@cbconsulting
Mar 29 2017 02:28
wow
MarwanSultan
@MarwanSultan
Mar 29 2017 02:28
I'm am trying to learn javascript.
Cory Bowles
@cbconsulting
Mar 29 2017 02:28
really was that simple
Joseph
@revisualize
Mar 29 2017 02:28
Yes
Moisés Man
@moigithub
Mar 29 2017 02:28
damn kidney hurts :crying_cat_face:
MarwanSultan
@MarwanSultan
Mar 29 2017 02:28

Assign the value 7 to variable a.

Assign the contents of a to variable b.

Cory Bowles
@cbconsulting
Mar 29 2017 02:28
@revisualize thank you
CamperBot
@camperbot
Mar 29 2017 02:28
truepalyer6 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3617 | @revisualize |http://www.freecodecamp.com/revisualize
MarwanSultan
@MarwanSultan
Mar 29 2017 02:28
how would I do that?
Joseph
@revisualize
Mar 29 2017 02:28
@MarwanSultan How do you assign the value of 7 to a variable num? ... var num = 7;
Now if you want you can use a variable to store values.
Like in mathmatics. num + 3 = 10 What is the value of num?
var x = num + 3; ... That outputs 10
So, you can do several things with variables. But, you need to understand that variables hold values and variables can be used with other variables.
So, how do you assign the value of 5 to a variable x? ... x = 5; (Which is also overwriting the previous value of 10 from above.
How do you assign the value of x to a variable y?
Look at the way things are written. var y = x;
How do you assign the value of 42 to a variable answer? ... What is the answer?
Variables hold values. Just understand that.
Cory Bowles
@cbconsulting
Mar 29 2017 02:29
@revisualize dont know why i was treating that function than i would any other day. Learn something new everyday.
Greg Laux
@GRLaux
Mar 29 2017 02:29
@revisualize Thanks again! I was headed in the right direction, but I forgot that whole thing about "multiplying by 0" :P
CamperBot
@camperbot
Mar 29 2017 02:29
grlaux sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: grlaux already gave revisualize points
FlashHero
@FlashHero
Mar 29 2017 02:30
@revisualize can you help me please
Joseph
@revisualize
Mar 29 2017 02:30
@FlashHero Nope. I have no idea what you're doing.
MarwanSultan
@MarwanSultan
Mar 29 2017 02:30
Thank you.
FlashHero
@FlashHero
Mar 29 2017 02:33
@revisualize I'm checking if there's an operator at the end if there is then remove it and if there isn't then solve the equation but the opposite of that is happening if I put an operator at the end it works but if I don't it doesn't work but it's suppose to work
Joseph
@revisualize
Mar 29 2017 02:33
@FlashHero Sorry, I'm also in a class. I can't help you with your issue.
Jason Luboff
@JLuboff
Mar 29 2017 02:33
Stupid Gitter can't tag you, but what's up with your kidney moises?
FlashHero
@FlashHero
Mar 29 2017 02:34
no problem @revisualize
Jason Luboff
@JLuboff
Mar 29 2017 02:37
@FlashHero you can't compare like that. You need to compare each operator to the sliced element....
Jason Luboff
@JLuboff
Mar 29 2017 02:43
And actually...slice returns an array...you're trying to compare an array to a string...
spencerjstewart
@spencerjstewart
Mar 29 2017 02:46
is it possible to use reduce() to sum an array of numbers, but by starting at a different index (say 2), instead of at 0?
Joseph
@revisualize
Mar 29 2017 02:47
@spencerjstewart Yes.
@spencerjstewart But, you need to program that logic.
veeeeeee
@veeeeeee
Mar 29 2017 02:50
Hi gang, I've been banging my head against the "Stand in Line" exercise. It occured to me that part of the problem I've been having with is that the exercise says return item; //Change this line
when it really means "Only change code above this line" (and below the "// Your Code Here" indicator
Is there a good place to make that suggestion? Github guidelines didn't seem to allow for UX tweaks
Gulsvi
@gulsvi
Mar 29 2017 02:54

@veeeeeee

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

  return item;  // Change this line
}

It says to add code above and to change that line. You can pass the challenge by leaving that line alone, but they likely want you to change that line.

Multiple ways to solve every problem :)
veeeeeee
@veeeeeee
Mar 29 2017 02:56
Nah, I did manage to solve the entire problem, but felt that it was a bit unclear and sent me down a rabbit hole of "WHAT THE HECK EVEN"
but i guess it's someone else's problem now :sweat_smile:
Gulsvi
@gulsvi
Mar 29 2017 02:57
function nextInLine(arr, item) {
  // Your code here adds an item to the end of the array
  return item;  // Change this line to return the item that was removed
}
Another way to look at it ^^
Matthew
@IMDBLM
Mar 29 2017 02:57
What's good y'all?
Gulsvi
@gulsvi
Mar 29 2017 02:58
Tequila :cactus: and algorithms :)
Jason Luboff
@JLuboff
Mar 29 2017 02:58
Ah you know, just working out.
Manish Giri
@Manish-Giri
Mar 29 2017 02:58
research
Joseph
@revisualize
Mar 29 2017 03:00

@veeeeeee Gist by revisualize / FreeCodeCamp - Stand in Line.js

// How do you add a number (item) to the end of an array (arr)? What does this method return?
// How do you remove the first element from an array (arr)? What does this method return?

You're supposed to:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:

function nextInLine(arr, item) { }

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.

You just need to add a number (item) to the end of an array (arr).
You also need to remove the first element from an array (arr).
But, there is another part of this challenge. You need to know What the methods that do those two things return.

The push() method adds one or more elements to the end of an array and returns the new length of the array.

The pop() method removes the last element from an array and returns that element.

The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

The shift() method removes the first element from an array and returns that element.

Jason Luboff
@JLuboff
Mar 29 2017 03:00
@Manish-Giri what're you researching?
Matthew
@IMDBLM
Mar 29 2017 03:00
@SkyCoder01 I lean towards bourbon when I'm learning, but yeah!
Manish Giri
@Manish-Giri
Mar 29 2017 03:01
@JLuboff my thesis stuff :tired_face:
Gulsvi
@gulsvi
Mar 29 2017 03:01
Wish I had some Basil Hayden right now :)
Jason Luboff
@JLuboff
Mar 29 2017 03:02
@Manish-Giri ...fun...is your major computer science??
Manish Giri
@Manish-Giri
Mar 29 2017 03:02
@JLuboff yeah, my thesis is on database design..
which sucks(for the most part)
Matthew
@IMDBLM
Mar 29 2017 03:03
@SkyCoder01 Too expensive for my blood. I do OGD BiB, though I just got a bottle of Old Forester BiB.
Roger Braun
@roger1891
Mar 29 2017 03:04
anybody knows a good thesis topic?
Jason Luboff
@JLuboff
Mar 29 2017 03:04
@Manish-Giri so you're the person to ask when I have database questions eh? I know basic SQL transact language but mostly forgot it all (took a class last semester)
Gulsvi
@gulsvi
Mar 29 2017 03:04
Haha! Nice. Cheers @IMDBLM
Manish Giri
@Manish-Giri
Mar 29 2017 03:04
@JLuboff lol yeah :joy:
select wtf from lol where id='gtfo'
:smiling_imp:
Jason Luboff
@JLuboff
Mar 29 2017 03:05
Yup! Looks about right!
My challenge soon will be integrating Node and Microsoft sql...
Manish Giri
@Manish-Giri
Mar 29 2017 03:06
@JLuboff have you used templates? like - http://handlebarsjs.com/
I was reading about these today
wonder what they're used for
Jason Luboff
@JLuboff
Mar 29 2017 03:07
No, I'm just learning about Node right now. I know angular is essentially for creating templates like that
Manish Giri
@Manish-Giri
Mar 29 2017 03:07
I tried going through the angular docs last night...
shut down the browser faster than I opened it :unamused:
MatthDuc
@Vagrantin
Mar 29 2017 03:07

Hi Guys, I'm kind of stuck here in the "Seek and Destroy" Challenge I don't get how i can manage to have the two parameters checked…

function destroyer(arr) {
  var args = arguments.length;
  var arg0 = arguments[0];
  var Nargs = Array.prototype.slice.call(arguments, 1);
  var newArr = [];


    newArr = arg0.filter(filtre);

    return newArr;    

     function filtre(e){

       for (var j=0; j<args; j++){
         for (var i in Nargs){

           return e !== Nargs[i];

       } 

     }
  }
}


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

In the for…in Loop, i'm going trough only one time because I have a return inside it… how can i manage to get all the values of Nargs[i] back to my fonction ?
See my testing here: https://repl.it/Gi5n/1

Manish Giri
@Manish-Giri
Mar 29 2017 03:08
@Vagrantin you might want to use .indexOf() here -
for (var j=0; j<args; j++){
         for (var i in Nargs){

           return e !== Nargs[i];

       } 

     }
Jason Luboff
@JLuboff
Mar 29 2017 03:08
@Manish-Giri haha, come on I know you're smarter with this stuff than I am. But I would imagine templates would be good when displaying database data
Manish Giri
@Manish-Giri
Mar 29 2017 03:10
@JLuboff lol, pls, I'm a n00b with most things!
Jason Luboff
@JLuboff
Mar 29 2017 03:12
About @Manish-Giri
CamperBot
@camperbot
Mar 29 2017 03:12
:star2: 4970 | @manish-giri |http://www.freecodecamp.com/manish-giri
Jason Luboff
@JLuboff
Mar 29 2017 03:12
Hmmm...your brownie points say otherwise 😂
Manish Giri
@Manish-Giri
Mar 29 2017 03:12
:joy:
MatthDuc
@Vagrantin
Mar 29 2017 03:12
@Manish-Giri, hum interesting let me look at that.
Jason Luboff
@JLuboff
Mar 29 2017 03:14
Just out of curiosity, is your thesis in regards to relational databases or nonrelational (nosql?) databases or both or neither?
Manish Giri
@Manish-Giri
Mar 29 2017 03:15
it's actually both
it's about a non relational database(graph db) and adding some new features to it that helps it excel over relational DBs
:disappointed:
I'm planning to incorporate it into a MEAN MERN app as well, replacing mongo entirely with the graph db
Jason Luboff
@JLuboff
Mar 29 2017 03:19
Interesting. MERN = mongo express react? Node..? Except it'll be GERN?
Manish Giri
@Manish-Giri
Mar 29 2017 03:20
yeah mongo express react node
Joel
@MMK123
Mar 29 2017 03:20
hello all
MatthDuc
@Vagrantin
Mar 29 2017 03:20
@Manish-Giri , i'm looking at indexOf and from what i understand it's already what i'm doing with the filter fonction which seems more concise isn't it ?
Andrew Charlebois
@andrewchar
Mar 29 2017 03:20
express.js is to node.js like jQuery is to JavaScript?
Manish Giri
@Manish-Giri
Mar 29 2017 03:20
since everyone chucked angular down the drain
Joel
@MMK123
Mar 29 2017 03:20
I could use some help
Manish Giri
@Manish-Giri
Mar 29 2017 03:20
@JLuboff GERN sounds cool though :sunglasses:
Jason Luboff
@JLuboff
Mar 29 2017 03:20
Cool. Well I'm going to ask you any DB questions I have in the future 😉
Manish Giri
@Manish-Giri
Mar 29 2017 03:20
maybe it'll turn out to be the next big thing
Jason Luboff
@JLuboff
Mar 29 2017 03:20
What's wrong with angular?
Manish Giri
@Manish-Giri
Mar 29 2017 03:21
@JLuboff sure sure anytime
Joel
@MMK123
Mar 29 2017 03:21
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Jason Luboff
@JLuboff
Mar 29 2017 03:21
You better give me credit 😂
Joel
@MMK123
Mar 29 2017 03:21

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

return item; // Change this line
}

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

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

not sure where to begin ...
thoughts?
Andrew Charlebois
@andrewchar
Mar 29 2017 03:22
@MMK123 remember push/pop/shift/unshift
they want you to add one to the end and remove the first
Joel
@MMK123
Mar 29 2017 03:22
vaguely, yes
Andrew Charlebois
@andrewchar
Mar 29 2017 03:23
read on mdn what they do and you will see right away what must be done
Joel
@MMK123
Mar 29 2017 03:23
mdn?
Andrew Charlebois
@andrewchar
Mar 29 2017 03:23
your bibble
Moisés Man
@moigithub
Mar 29 2017 03:23
most of the exercise are based on previous challenges... soo if u lost/dont know.. it just mean u need to go back n redo
Joel
@MMK123
Mar 29 2017 03:23
ok i'll go back and look at those exercises as well as mdn
Andrew Charlebois
@andrewchar
Mar 29 2017 03:24
yeah just look over array manipulation stuff over again
MatthDuc
@Vagrantin
Mar 29 2017 03:24
@andrewchar no not really express.js is a Framework for Node jQuery is a library for Js.
A Framework as much more set of tools than a library is more set of helper functions.
Andrew Charlebois
@andrewchar
Mar 29 2017 03:25
@Vagrantin ahh ok. im at a point in my JS knowledge where i am expanding to React now.
wondering what else i should get into
Jeffrey
@jdale86
Mar 29 2017 03:25

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  myObj.hasOwnProperty(checkProp);{
  if(true){
    return myObj[checkProp];
  }else{
    return "Not Found";
  }

  }
  }

// Test your code by modifying these values
checkObj("house");
if anyone can spare a moment
Manish Giri
@Manish-Giri
Mar 29 2017 03:26
@Vagrantin this is what worked for me -
function destroyer(arr) {
  var args = arguments.length;
  var arg0 = arguments[0];
  var Nargs = Array.prototype.slice.call(arguments, 1);

    return arg0.filter(function(element){
      return Nargs.indexOf(element) === -1;
    });
}
Jeffrey
@jdale86
Mar 29 2017 03:26
they all work except when I try a false statement. not sure the issue
Moisés Man
@moigithub
Mar 29 2017 03:26
u need to move hasOwnProperty check INSIDE the if parens @jdale86
Manish Giri
@Manish-Giri
Mar 29 2017 03:27
@Vagrantin I think the problem with your for loop (as you pointed out yourself), was the return statement..
Jeffrey
@jdale86
Mar 29 2017 03:27
okay, thanks. I'll try to look at that.
@moigithub thanks
CamperBot
@camperbot
Mar 29 2017 03:27
jdale86 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2918 | @moigithub |http://www.freecodecamp.com/moigithub
Roxroy
@roxroy
Mar 29 2017 03:28
@jdale86 , the issue is with if(true) you should put the myObj.hasOwnProperty(checkProp) in the if statement
Jeffrey
@jdale86
Mar 29 2017 03:29
i see but shouldn't that statement return true or false?
i feel like i'm missing something fundamental here
haha
@roxroy thanks
CamperBot
@camperbot
Mar 29 2017 03:30
jdale86 sends brownie points to @roxroy :sparkles: :thumbsup: :sparkles:
:cookie: 491 | @roxroy |http://www.freecodecamp.com/roxroy
Ramesh
@rnallu
Mar 29 2017 03:31
Guys, How to call html input text value in js without using button in html?
Jeffrey
@jdale86
Mar 29 2017 03:32
i'm an idiot. I think i understand now.
Ray Martinez
@rayjrm
Mar 29 2017 03:32
Not an idiot :)
Jeffrey
@jdale86
Mar 29 2017 03:33
thanks haha.
Andrew Charlebois
@andrewchar
Mar 29 2017 03:34
@rnallu like .innerHtml?
@rnallu you're looking for text value of a node?
like text in a p tag?
Jeffrey
@jdale86
Mar 29 2017 03:35
I've done 54 challenges today... so i probably just need some time to absorb it all. You all are always great! thanks!
Ray Martinez
@rayjrm
Mar 29 2017 03:35
Ha yeah, you can only absorb so much
Jeffrey
@jdale86
Mar 29 2017 03:36
@rayjrm thanks
CamperBot
@camperbot
Mar 29 2017 03:36
jdale86 sends brownie points to @rayjrm :sparkles: :thumbsup: :sparkles:
:cookie: 13 | @rayjrm |http://www.freecodecamp.com/rayjrm
Ray Martinez
@rayjrm
Mar 29 2017 03:36
forgetting is a vital part of remembering
Jeffrey
@jdale86
Mar 29 2017 03:36
I'll keep that in mind
Ramesh
@rnallu
Mar 29 2017 03:36
@andrewchar Value in Input form, which i'm using for search option. My requirement is to take the input value to js after hitting enter. There will be no button for submitting the form.
snoopy69
@snoopy69
Mar 29 2017 03:37
afafafgn
Keith Neemann
@keithneemann
Mar 29 2017 03:39
Hey guys I just started the JavaScript challenge and I am having issues with Increment a Number. I'm not sure what I am missing... myVar =myVar ++ 1; It keeps telling me I am missing a semicolon. Can someone explain this?
Ray Martinez
@rayjrm
Mar 29 2017 03:40
Can you post the entire code? It may be elsewhere that you're missing a semicolon.
Ramesh
@rnallu
Mar 29 2017 03:41
@keithneemann either myVar++; or myVar+1; should be.
Keith Neemann
@keithneemann
Mar 29 2017 03:41

the full code is

var myVar = 87;

// Only change code below this line
myVar = myVar + 1;

snoopy69
@snoopy69
Mar 29 2017 03:42
@keithneemann well having the same issue here but I figure you have add the numbers
Andrew Charlebois
@andrewchar
Mar 29 2017 03:42
@keithneemann when you want to increment by 1, you just need to use ++
myvar++
no need to use the number.
if you do anything other then increase num by 1. then you would do myvar+NUM
Keith Neemann
@keithneemann
Mar 29 2017 03:44
@andrewchar when I add the second (+) it tells me I am missing a semicolon and when I remove the number it tells me that my answer doesnt = 88 like its supposed to
Ray Martinez
@rayjrm
Mar 29 2017 03:45
because myVar + someNum; just gives you an evaluation. You need to assign it to myVar, like so...
myVar += 1;
Matthew
@IMDBLM
Mar 29 2017 03:47
Well maybe yourVar does...
Ramesh
@rnallu
Mar 29 2017 03:48
Value in Input form, which i'm using for search option. My requirement is to take the input value to js after hitting enter. There will be no button for submitting the form. How we can achieve it?
Matthew
@IMDBLM
Mar 29 2017 03:48
You know what, I'm stupid - never mind. :+1:
Andrew Charlebois
@andrewchar
Mar 29 2017 03:52
@rnallu there are many ways to get the value in the form. such ways are document.getElementById("searchTxt").value; /// document.querySelector('#searchTxt').value;
Joseph
@revisualize
Mar 29 2017 03:54
Hey hey
Andrew Charlebois
@andrewchar
Mar 29 2017 03:54
@rnallu you an then submit the form watching for the return key to be hit
e.keyCode == 13
i think the return key is keybode 13.
keycode
in your html you could do something like onKeyPress="return checkSubmit(event)
for checking all of this
make a function of it
@revisualize sup
Joseph
@revisualize
Mar 29 2017 03:56
On the bus.
Ray Martinez
@rayjrm
Mar 29 2017 03:57
Fun
shawnmf
@shawnmf
Mar 29 2017 03:57
So I'm in the JS lessons and I have no idea what Stand in Line is asking me to do with queues
Joseph
@revisualize
Mar 29 2017 03:58
It is asking you to make one.
A horrible queue but, none the less a queue.
shawnmf
@shawnmf
Mar 29 2017 03:58
using what .pop and .shift?
Joseph
@revisualize
Mar 29 2017 03:59
No yes
shawnmf
@shawnmf
Mar 29 2017 03:59
sorry .push
Joseph
@revisualize
Mar 29 2017 03:59
Yes
Ray Martinez
@rayjrm
Mar 29 2017 03:59
You need to push a value into the array, and then return the first item in the array by using shift. This is a form of a queue. @shawnmf
shawnmf
@shawnmf
Mar 29 2017 03:59
Ok I thought that was the train of thought
Joseph
@revisualize
Mar 29 2017 04:00
You dont HAVE to use .push()
Aaron Bell
@awb715
Mar 29 2017 04:01
@revisualize canceled event
Joseph
@revisualize
Mar 29 2017 04:02
Yeah. That pissed me off.
Really pissed me off.
Aaron Bell
@awb715
Mar 29 2017 04:02
haha
yeah the guy was a dick in telling me it was canceled
Matthew
@IMDBLM
Mar 29 2017 04:02
@shawnmf This challenge tripped me up like crazy the 2nd time I tried it. Stick at it!
Joseph
@revisualize
Mar 29 2017 04:02
Me too!
Knife weilding fucker got the damn event cancelled.
Aaron Bell
@awb715
Mar 29 2017 04:03
yeah
Joseph
@revisualize
Mar 29 2017 04:03
I would have tased his asa.
Matthew
@IMDBLM
Mar 29 2017 04:03
@awb715 @revisualize You guys have local coding event? I'm asking because my local leader has yet to not cancel a meetup.
Joseph
@revisualize
Mar 29 2017 04:03
I live in Seattle.
Aaron Bell
@awb715
Mar 29 2017 04:03
well meetup.com is what werever referring to, but yes
Joseph
@revisualize
Mar 29 2017 04:03
There are a TON of events.
shawnmf
@shawnmf
Mar 29 2017 04:04
@IMDBLM I just feel like it just throws the queue at you and says have at it
Ray Martinez
@rayjrm
Mar 29 2017 04:04
Try meetup.com There events a local groups everywhere
Joseph
@revisualize
Mar 29 2017 04:04
Depends where you live though.
Matthew
@IMDBLM
Mar 29 2017 04:04
@revisualize I know I'm just asking if your local group is pretty active or whatever
Joseph
@revisualize
Mar 29 2017 04:04
Local FCC group?
Matthew
@IMDBLM
Mar 29 2017 04:05
Yeah
Joseph
@revisualize
Mar 29 2017 04:05
No idea
shawnmf
@shawnmf
Mar 29 2017 04:05
I'm in the South Tacoma,WA Area, but I have yet to go to a meetup
Joseph
@revisualize
Mar 29 2017 04:05
Go.
Ray Martinez
@rayjrm
Mar 29 2017 04:05
Really.
Do it.
Joseph
@revisualize
Mar 29 2017 04:05
The events in Seatle have free food and free beer.
Most of them do at least.
shawnmf
@shawnmf
Mar 29 2017 04:06
I like the sound
of that
Joseph
@revisualize
Mar 29 2017 04:06
I think the company sponsored events in Tacoma have food.
I used to only eat dinner by going to meetup events.
shawnmf
@shawnmf
Mar 29 2017 04:07
It's about an hour from JBLM (The Army Base) to Seattle so Tacoma would be closer for me
lol
Joseph
@revisualize
Mar 29 2017 04:07
Ta oma should have events.
Matthew
@IMDBLM
Mar 29 2017 04:08
@revisualize That' s some struggle there haha
shawnmf
@shawnmf
Mar 29 2017 04:08
Yeah, they should. I think Olympia as well, but I think it is a smaller group
MatthDuc
@Vagrantin
Mar 29 2017 04:10
@Manish-Giri Thx ! i have to read again the indexOf doc because I think i didn't get the wait it's working! Thanks a lot for the help !
CamperBot
@camperbot
Mar 29 2017 04:10
vagrantin sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4972 | @manish-giri |http://www.freecodecamp.com/manish-giri
Joseph
@revisualize
Mar 29 2017 04:10
Struggle?
Dude. I used to be homeless.
Manish Giri
@Manish-Giri
Mar 29 2017 04:10
@Vagrantin indexOf() returns a -1 if an element is not found in the array.
that's the main thing you want to remember for this challenge.
Manish Giri
@Manish-Giri
Mar 29 2017 04:12

I'll break it down for you -

return arg0.filter(function(element){
      return Nargs.indexOf(element) === -1;
    });

what this does is - goes through each of the element in arg0 array, and for each element, it checks if that element is present/not present in the Nargs array.

@Vagrantin
Rebeca
@rgarn3r
Mar 29 2017 04:12

function testElse(val) {
var result = "";
// Only change code below this line

if (val > 5) {
result = "Bigger than 5";
}

else if (val <= 5) {
result = "5 or Smaller";
}

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

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

what's wrong?
Matthew
@IMDBLM
Mar 29 2017 04:13
Wild. I've had some tough times but never without shelter thankfully.
Rebeca
@rgarn3r
Mar 29 2017 04:13
"You should only have one if statement in the editor"
Ray Martinez
@rayjrm
Mar 29 2017 04:13
Your else if, just needs to be an Else.
Matthew
@IMDBLM
Mar 29 2017 04:14
@shawnmf how you coming along?
Ray Martinez
@rayjrm
Mar 29 2017 04:14
Cause if its not greater than 5, it can only be less.
Manish Giri
@Manish-Giri
Mar 29 2017 04:14

for example -

[1, 2, 3, 1, 2, 3], [2,3]

the first iteration - 1 is not present in the Nargs array - [2,3] (.indexOf() returns -1), so we keep 1 in the returned array.
the second iteration - 2 is present in the Nargs array (.indexOf() doesn't return -1), so we don't keep 2 in the returned array.
And so on...
@Vagrantin

M-Areeb
@M-Areeb
Mar 29 2017 04:17

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var addThree = oldArray.map(function(val){
return val +=3;
});
var newArray = oldArray;
//This is iterate over array wiyh map function .

I am unable to figure out where i am wrong.
Andrew Shieh
@andrewlikes
Mar 29 2017 04:23
@M-Areeb val +=3
i dont think you need +=
just +3
MatthDuc
@Vagrantin
Mar 29 2017 04:25
@Manish-Giri Thx again for the explanation !
CamperBot
@camperbot
Mar 29 2017 04:25
vagrantin sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: vagrantin already gave manish-giri points
Andrew Shieh
@andrewlikes
Mar 29 2017 04:26
@M-Areeb your code actually works. I used console.log(addThree); to get the values
shawnmf
@shawnmf
Mar 29 2017 04:28
@IMDBLM I had to put the kid to bed so I just came back to it
Joseph
@revisualize
Mar 29 2017 04:28
@awb715 They rescheduled the event: We have rescheduled tonight's event to 4/26/17 from 6-8 pm. I'm sorry for any inconvenience.
Matthew
@IMDBLM
Mar 29 2017 04:32
@shawnmf fair! I don't get started until nearly 11pm when my wife goes to bed.
Aaron Bell
@awb715
Mar 29 2017 04:33
long time from now lol
i think im done with this
byronwatson
@byronwatson
Mar 29 2017 04:35
i've been stuck on task #196 for some time. I searched for help with this task on google and found people using this code: if (a < 0 || b < 0)
and the crazy question I have to ask is. How do I make the 2 lines that separate the 2 less than statements?
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 04:36

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
   if (myObj.hasOwnProperty("checkProp")===true){return myObj[checkProp];}
  return "Not Found";
}

// Test your code by modifying these values
checkObj("gift");
hello everyone.....pls ma code aint passing.........what could be wrong.......
could dis be a bug or something
Joseph
@revisualize
Mar 29 2017 04:41
@dav4thevid "checkProp" is that a string or a variable?
Matthew
@IMDBLM
Mar 29 2017 04:41

I'm going back through nesting for loops and while I can pass the challenge, I'm confused by this sentence in the instructions:

Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.

How exactly does [i] become an array itself?
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 04:42
its a string?
Aaron Bell
@awb715
Mar 29 2017 04:42
if there is a array in a array
@revisualize what you think of my calculator
Matthew
@IMDBLM
Mar 29 2017 04:42
I thought the i is the array, and the j is the sub array
Fabusuyi David Oluwasegun
@dav4thevid
Mar 29 2017 04:43
@revisualize thanks
CamperBot
@camperbot
Mar 29 2017 04:43
dav4thevid sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3618 | @revisualize |http://www.freecodecamp.com/revisualize
byronwatson
@byronwatson
Mar 29 2017 04:44
if (a < 0 || b < 0) can anyone tell me how to make those 2 separator lines?
actually NM
i am just way too tired
Joseph
@revisualize
Mar 29 2017 04:44
about @awb715
CamperBot
@camperbot
Mar 29 2017 04:44
:cookie: 312 | @awb715 |http://www.freecodecamp.com/awb715
Aaron Bell
@awb715
Mar 29 2017 04:44
im asking what you think of it
Joseph
@revisualize
Mar 29 2017 04:45
@awb715 What calculator?
Joseph
@revisualize
Mar 29 2017 04:46
@awb715 I don't like it.
Ray Martinez
@rayjrm
Mar 29 2017 04:46
Shots fired
Aaron Bell
@awb715
Mar 29 2017 04:46
thanks
Joseph
@revisualize
Mar 29 2017 04:46
@awb715 5 X -5 is?
-25
Your calculator outputs -5
A calculator should do math.
@awb715 What is 1 + .000002 ?
not 1.00
@awb715 Overall, the buttons work. The layout is a basic calculator. For basic whole numbers or monetary values. It works.
Aaron Bell
@awb715
Mar 29 2017 04:50
the - isnt a negative
its subtraction
thats why its -5
Joseph
@revisualize
Mar 29 2017 04:50
Hmm
Maybe add a +/- ?
Aaron Bell
@awb715
Mar 29 2017 04:51
yeah
and now try 1+.0002
i had a round on all calculations
now i just have it on division
my js is so sloppy tho
i should be using methods
Joseph
@revisualize
Mar 29 2017 04:51
@awb715 Also, I don't think people will know what % means
maybe change that to read mod
Aaron Bell
@awb715
Mar 29 2017 04:52
mod?
Joseph
@revisualize
Mar 29 2017 04:53
Look on the calculator on your computer
The advanced calculator
Ray Martinez
@rayjrm
Mar 29 2017 04:54
modulo
Ogundele Olumide
@Lumexralph
Mar 29 2017 04:58
@dav4thevid first hasOwnProperty returns a boolean, no need of === true, you're to check checkProp parameter not string
shawnmf
@shawnmf
Mar 29 2017 05:00
@IMDBLM This is as far as I got but I can't get nextInLine([5,6,7,8,9], 1) should return 5 to clear:

function nextInLine(arr, item) {
// Your code here
testArr.push(item);
return testArr.shift(); // Change this line
}

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

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

Ogundele Olumide
@Lumexralph
Mar 29 2017 05:01
@shawnmf arr is the parameter holding the array not testArr
shawnmf
@shawnmf
Mar 29 2017 05:01
I tried placing the testArr = [5,6,7,8,9] but it will not clear the task
oh I see
Joseph
@revisualize
Mar 29 2017 05:02
@shawnmf Let me ask you a few questions.
shawnmf
@shawnmf
Mar 29 2017 05:02
I need to declare the arr varible
Joseph
@revisualize
Mar 29 2017 05:02
@shawnmf No.
shawnmf
@shawnmf
Mar 29 2017 05:02
ok what's the questions?
Joseph
@revisualize
Mar 29 2017 05:02

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.

Matthew
@IMDBLM
Mar 29 2017 05:02
let him ask you the questions
haha
Joseph
@revisualize
Mar 29 2017 05:04
I actually lost the pre-typed junk that I have for the question.
shawnmf
@shawnmf
Mar 29 2017 05:04
got it lol
I see what you were saying I was not using arr in the function
Jai Mitch
@jaimitch
Mar 29 2017 05:06
how do you make sure the lines you are writing aren't over-riding each other?
shawnmf
@shawnmf
Mar 29 2017 05:06
@revisualize Thanks for kick starting me to reexamine my function. I was using the wrong variable.
CamperBot
@camperbot
Mar 29 2017 05:06
shawnmf sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3619 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Mar 29 2017 05:07
@jaimitch WHat?
snoopy69
@snoopy69
Mar 29 2017 05:09
does anyone had any luck with the js temperature exercise?
Ogundele Olumide
@Lumexralph
Mar 29 2017 05:12
@snoopy6 maybe, tried anything?
Jai Mitch
@jaimitch
Mar 29 2017 05:13
@revisualize I have an algorithm Im working on to convert degrees from celsius to fahrenheit. this is what I have so far convertToF(0);
convertToF(-30);
convertToF(-10);
convertToF(20);
convertToF(30); the last line of quote over-rides the previous and I can't get it to read each line separately.
Ogundele Olumide
@Lumexralph
Mar 29 2017 05:19
@jaimitch can you show your code?
Jai Mitch
@jaimitch
Mar 29 2017 05:21

@Lumexralph 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(0);
convertToF(-30);
convertToF(-10);
convertToF(20);
convertToF(30);

Ogundele Olumide
@Lumexralph
Mar 29 2017 05:22
@jaimitch you're inputting values yourself, you have a celsius parameter in the function, rememeber?
Jor
@joreyesl
Mar 29 2017 05:23
@jaimitch so notice how the formula is the same, the only thing that changes is the celsius value? That is what parameters are for.
in the function declaration function convertToF(celsius) we have defined the parameter celsius. That parameter will hold the value that is passed to the function in convertToF(30), convertToF(20) etc. You just need 1 line and dont hardcode the 20, 30 etc. Instead use the parameter celsius in the formula.
@Lumexralph :wave:
Joseph
@revisualize
Mar 29 2017 05:28

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

Ogundele Olumide
@Lumexralph
Mar 29 2017 05:32
@joreyesl grandmaster :smiling_imp:
Good Morning
Jor
@joreyesl
Mar 29 2017 05:34
@Lumexralph I'm recruit, @Manish-Giri is grandmaster. :smiling_imp:
Manish Giri
@Manish-Giri
Mar 29 2017 05:35
white lies
I'm noob
@joreyesl and @Lumexralph are reigning grandmasters
Ogundele Olumide
@Lumexralph
Mar 29 2017 05:35
@joreyesl I'm an Intern, in Nish Inc.
Manish Giri
@Manish-Giri
Mar 29 2017 05:35
:smiling_imp:
Ogundele Olumide
@Lumexralph
Mar 29 2017 05:35
@joreyesl you see he's everywhere
Manish Giri
@Manish-Giri
Mar 29 2017 05:36
:smiling_imp:
MAKE FCC :smiling_imp: again
snoopy69
@snoopy69
Mar 29 2017 05:37
@Lumexralph well I think I'm just tired haha
Jor
@joreyesl
Mar 29 2017 05:43
@Manish-Giri @Lumexralph :smiling_imp: is everywhere
Aaron Bell
@awb715
Mar 29 2017 05:44
@revisualize check it now
Jim
@JLOSS1
Mar 29 2017 05:49
@joreyesl thanks for the help on my weather app the other night. got it to work great.
CamperBot
@camperbot
Mar 29 2017 05:49
jloss1 sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 692 | @joreyesl |http://www.freecodecamp.com/joreyesl
Joseph
@revisualize
Mar 29 2017 05:58
@awb715 Much better
@awb715 Rename the % to mod
Aaron Bell
@awb715
Mar 29 2017 05:59
the % now turns the number into a %
so like 1 would turn to 1%
@revisualize
Joseph
@revisualize
Mar 29 2017 05:59
@awb715 Cool.
@revisualize
Joseph
@revisualize
Mar 29 2017 06:08
@awb715 Are you getting job offers?
Aaron Bell
@awb715
Mar 29 2017 06:09
no haha
i wish
Joseph
@revisualize
Mar 29 2017 06:10
@awb715 Isn't that what's supposed to happen. You create a website and the job offers start rolling in.
Aaron Bell
@awb715
Mar 29 2017 06:11
i smell sarcasm
Rudy Hernandez
@rudolphh
Mar 29 2017 06:13
@awb715 really like the portfolio site. thanks for sharing :thumbsup:
CamperBot
@camperbot
Mar 29 2017 06:13
rudolphh sends brownie points to @awb715 :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @awb715 |http://www.freecodecamp.com/awb715
Jor
@joreyesl
Mar 29 2017 06:13
@JLOSS1 np :thumbsup:
@rudolphh ty
CamperBot
@camperbot
Mar 29 2017 06:14
joreyesl sends brownie points to @rudolphh :sparkles: :thumbsup: :sparkles:
:cookie: 100 | @rudolphh |http://www.freecodecamp.com/rudolphh
Rudy Hernandez
@rudolphh
Mar 29 2017 06:15
100 cookies!!! ty @joreyesl
CamperBot
@camperbot
Mar 29 2017 06:15
rudolphh sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 693 | @joreyesl |http://www.freecodecamp.com/joreyesl
Jor
@joreyesl
Mar 29 2017 06:16
@rudolphh already at 100 in less than a week, you will pass me in no time :clap:
Rudy Hernandez
@rudolphh
Mar 29 2017 06:17
i'm sure you'll stay ahead ;)
Markus Kiili
@Masd925
Mar 29 2017 06:19
@joreyesl @rudolphh @revisualize Good morning.
Rudy Hernandez
@rudolphh
Mar 29 2017 06:19
morning? lol its almost midnight @Masd925 good morning to you.
Aaron Bell
@awb715
Mar 29 2017 06:20
thanks @rudolphh
CamperBot
@camperbot
Mar 29 2017 06:20
awb715 sends brownie points to @rudolphh :sparkles: :thumbsup: :sparkles:
:cookie: 101 | @rudolphh |http://www.freecodecamp.com/rudolphh
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:21
@Masd925 CSS can be a pain in the head than JS at times.... especially Pure CSS
devpaaji
@devpaaji
Mar 29 2017 06:22
@Lumexralph gm friend
how are you doing
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:22
@Masd925 Good Morning
Joseph
@revisualize
Mar 29 2017 06:22
@Masd925 :wave:
devpaaji
@devpaaji
Mar 29 2017 06:22
and your search going for work
@Masd925 gm
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:22
@devpaaji Hey Man :smile: Morning
devpaaji
@devpaaji
Mar 29 2017 06:22
how are you doing
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:23
@devpaaji am good, thanks.... about running out to work, you?
CamperBot
@camperbot
Mar 29 2017 06:23
lumexralph sends brownie points to @devpaaji :sparkles: :thumbsup: :sparkles:
:cookie: 222 | @devpaaji |http://www.freecodecamp.com/devpaaji
Markus Kiili
@Masd925
Mar 29 2017 06:23
@Lumexralph I have a friend that does mainly front HTML+CSS. He said that you can learn it indefinitely.
@Lumexralph Good morning.
devpaaji
@devpaaji
Mar 29 2017 06:23
CSS is master stroke of web
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:23
@Masd925 I agree, it's a thick forest
devpaaji
@devpaaji
Mar 29 2017 06:23
and JS is back bone
@Lumexralph you got work
which tech stack and what you been doing lately
Ogundele Olumide
@Lumexralph
Mar 29 2017 06:25
@devpaaji not in an IT company yet, but bills have to be paid..... I am working on Python and Building my calculator project and doing some VanillaJS stuffs
devpaaji
@devpaaji
Mar 29 2017 06:27
thats great
small side projects keeps you always in touch
and soon you will hit the eye
keep up good work
just focus on vanilla JS
market is crowded with frameworks and often confused what to do and why to do
Joseph
@revisualize
Mar 29 2017 06:29
My focus is on Vanilla JS
devpaaji
@devpaaji
Mar 29 2017 06:30
@Lumexralph when removing bullet points from CSS
do we set list-style none to Ul or LI
if so why
Markus Kiili
@Masd925
Mar 29 2017 06:33
@devpaaji On ol or ul I think.
devpaaji
@devpaaji
Mar 29 2017 06:33
for(var j=0; j > arr.length; i++); why ? more than
Ayush Bahuguna
@relentless-coder
Mar 29 2017 06:33
@devpaaji list-style-type applies to a list item element. Since li is the only list item element, hence it doesn't matter. if there was situation where we had another list item element we'd have to decide between the whole list ul or ol or a particular list item.
devpaaji
@devpaaji
Mar 29 2017 06:37
From the docs
Inheritance will transfer the 'list-style' values from OL and UL elements to LI elements. This is the recommended way to specify list style information.
@Masd925 @relentless-coder
however, ie6 and 7 won't recognize this inheritance correctly, so you'll have to apply the list styles to li elements if you plan to support them
Ayush Bahuguna
@relentless-coder
Mar 29 2017 06:42
no one should use ie6 and ie7. even microsoft themselves stopped caring for ie
Rudy Hernandez
@rudolphh
Mar 29 2017 06:45
ie6... :dreamy: brings back childhood memories. :wub: internet exploder
Vicky Lai
@vickylai
Mar 29 2017 06:50
'Llo room!
I don't feel like I have a handle on my js here. Can someone help me understand why it's not working?
https://codepen.io/vickylaixy/pen/yMaeQL?editors=0010
Rudy Hernandez
@rudolphh
Mar 29 2017 06:50
@vickylaixy have you checked the console?
Vicky Lai
@vickylai
Mar 29 2017 06:51
@rudolphh Doesn't seem to be anything there...
Rudy Hernandez
@rudolphh
Mar 29 2017 06:52
says your api request is blocked because its over http and not https
Vicky Lai
@vickylai
Mar 29 2017 06:52
@rudolphh How do you see that?
Joseph
@revisualize
Mar 29 2017 06:53
@vickylaixy Concole.
jquery.min.js:4 Mixed Content: The page at 'https://codepen.io/vickylaixy/pen/yMaeQL?editors=0010' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en&jsonp=?'. This request has been blocked; the content must be served over HTTPS.
@vickylaixy CORS
Rudy Hernandez
@rudolphh
Mar 29 2017 06:53
@vickylaixy i'm assuming you're using chrome. right-click in your project 'frame' and click 'inspect'
Joseph
@revisualize
Mar 29 2017 06:54
@vickylaixy Lookup CORS if you don't have an HTTPS API that you can call.
Vicky Lai
@vickylai
Mar 29 2017 06:55
@rudolphh Got you, thanks. I had clicked "Console" at the bottom of the codepen window instead.
CamperBot
@camperbot
Mar 29 2017 06:55
vickylaixy sends brownie points to @rudolphh :sparkles: :thumbsup: :sparkles:
:cookie: 102 | @rudolphh |http://www.freecodecamp.com/rudolphh
Vicky Lai
@vickylai
Mar 29 2017 06:55
@revisualize Will do
Dhavalkumar Prajapati
@adhavalboy
Mar 29 2017 07:02
i plugged contact form 7 in wordpress but i can't receive mail from the form!!?
redoz94
@redoz94
Mar 29 2017 07:05
could someone please have a look at this and tell me why it is showing unexpected string on my javascript?
http://codepen.io/Redoz12/pen/zZJpQj
iso
@iso1048
Mar 29 2017 07:05

Could someone please tell me why the code below does not work? (dont tell me how to fix it though, just indicate the error please)

function factorialize(num) {
var array = [];
var product = 0;
for (var i=1; i <= num; i++) {
array.push(i);
}
array.reduce(function(i){
product = i*(i-1);
});
return product;
}

factorialize(10);

Pieter Stokkink
@forkerino
Mar 29 2017 07:08
@gothamknight the error is in the reduce.
specifically the callback function
Markus Kiili
@Masd925
Mar 29 2017 07:10
@gothamknight You could look at simple reduce examples on MDN reduce page.
Pieter Stokkink
@forkerino
Mar 29 2017 07:10
actually, the result of the reduce gets thrown away as well.
Markus Kiili
@Masd925
Mar 29 2017 07:10
@gothamknight For just causing side effects it is better to use forEach.
Pieter Stokkink
@forkerino
Mar 29 2017 07:21
@redoz94 you are missing a + after loc[0]
Kieran Williames
@kswilliames
Mar 29 2017 07:22
Hey guys
I'm having trouble with the Check for Palindromes challenge
Specifically this criterion error "palindrome("1 eye for of 1 eye.") should return false.". If you remove all of the whitespace, symbols and numbers it resolves as a palindrome...
Jor
@joreyesl
Mar 29 2017 07:24
@kswilliames you have to keep letters and numbers
Markus Kiili
@Masd925
Mar 29 2017 07:24
@kswilliames Numbers are not to be removed.
Kieran Williames
@kswilliames
Mar 29 2017 07:24
Haha
facepalm Thanks guys. I misread the question.
iso
@iso1048
Mar 29 2017 07:26
@forkerino i'm still having trouble. Could you point me in the right direction please?
Pieter Stokkink
@forkerino
Mar 29 2017 07:28
@gothamknight .reduce takes a callback with at least two arguments. These two are the previous (accumulated) and current value in the array. This function should return something, because that will be the next previous value or the return value of the reduce as a whole if there is no next value in the array.
Heuer-C
@Heuer-C
Mar 29 2017 07:28
I need help TAT
Pieter Stokkink
@forkerino
Mar 29 2017 07:28
@gothamknight but you really could do everything inside your first loop.
Heuer-C
@Heuer-C
Mar 29 2017 07:28
JL2%EJ6A%_8SFB5G_Z]_AA0.png
why this sentence dosen't work
Pieter Stokkink
@forkerino
Mar 29 2017 07:29
@Heuer-C "this.id" should be this.id, I think
Heuer-C
@Heuer-C
Mar 29 2017 07:29
yes i have tried but still can't change something
Rudy Hernandez
@rudolphh
Mar 29 2017 07:30
why don't they teach a little recursion before palindromes? its one of the first use-cases you're shown when learning that
Kieran Williames
@kswilliames
Mar 29 2017 07:30
I used recursion for the factorialization problem.
Pieter Stokkink
@forkerino
Mar 29 2017 07:30
@rudolphh never thought about it that way. :)
Kieran Williames
@kswilliames
Mar 29 2017 07:31
How can recursion be used to solve the palindrome problem?
Rudy Hernandez
@rudolphh
Mar 29 2017 07:31
@forkerino
function factorialize(num) {
  return num === 0 ? 1 : num * factorialize(num-1);
}
Pieter Stokkink
@forkerino
Mar 29 2017 07:31
I thought you said palindromes
MatthDuc
@Vagrantin
Mar 29 2017 07:31

@andrewchar it really depends what you are interested in as per library and framework you have tones of it, from top of my head, you have

FrontEnd:

vue.js React
handelbarjs mustacheJS
bootstrap foundation

Back-End:

*NodeJS

FullStack:

*meteorJS

Library:

D3 jQuery
underscoreJS BackboneJS

Framework:

ExpressJS AngularJs
*EmberJs

And it's a small list :smile: you have even more !
Today from what i have seen, the trend is:
Node.JS React
*AngularJS

Heuer-C
@Heuer-C
Mar 29 2017 07:31
blob
just like it
Rudy Hernandez
@rudolphh
Mar 29 2017 07:31
sorry was thinking of another (prob for @gothamknight) but i did recursion on that too. give me a sec
Kieran Williames
@kswilliames
Mar 29 2017 07:32
@rudolphh thanks :smile:
CamperBot
@camperbot
Mar 29 2017 07:32
kswilliames sends brownie points to @rudolphh :sparkles: :thumbsup: :sparkles:
:cookie: 105 | @rudolphh |http://www.freecodecamp.com/rudolphh
Kieran Williames
@kswilliames
Mar 29 2017 07:32
Whoah
Rudy Hernandez
@rudolphh
Mar 29 2017 07:33
could prob be improved somewhere
function palindrome(str) {

  // Good luck!
  if(!str){ return false; }
  if(str.length == 1) return true;
  if(str.length == 2 && str[0] == str[1]){ return true; }

  let myStr = str.trim().toLowerCase().replace(/\W|_/g, "");

  if(myStr[0] == myStr[myStr.length-1])
    return palindrome (myStr.substring(1, myStr.length-1));
  else return false; 

}
Heuer-C
@Heuer-C
Mar 29 2017 07:33
blob
hello?
Pieter Stokkink
@forkerino
Mar 29 2017 07:33
@Heuer-C it doesn't work?
Heuer-C
@Heuer-C
Mar 29 2017 07:33
yes @forkerino
Maks Ushakov
@maks-ushakov
Mar 29 2017 07:34

@rudolphh
i had done palindrome challenge this way


function palindrome(str) {
  // Good luck!
  var suspect = str.toLowerCase().replace(/[^a-z0-9]/g,'');
  var size = suspect.length;
  var halfSize = Math.floor( size / 2);
  for (var i = 0; i < halfSize; i++) {
    if(suspect[i] !== suspect[size - i - 1]) {
      return false;
    }
  }
  return true;
}

how do it with recursion?

Heuer-C
@Heuer-C
Mar 29 2017 07:35
this.id why it couldn't work
Rudy Hernandez
@rudolphh
Mar 29 2017 07:35
@maks-ushakov i like that ty. see above i just posted.
CamperBot
@camperbot
Mar 29 2017 07:35
rudolphh sends brownie points to @maks-ushakov :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @maks-ushakov |http://www.freecodecamp.com/maks-ushakov
Markus Kiili
@Masd925
Mar 29 2017 07:35
@maks-ushakov Check if length is <2. Compare first and last characters. If not equal, call palindrome with a substring and return.
Pieter Stokkink
@forkerino
Mar 29 2017 07:35
@Heuer-C maybe you have to use event.target.id and have event as function parameter. Don't pass anything to the function in your html
@rudolphh :) yeah, it is quite long, with a lot of return statements, but I guess it works. I just think a simple string reverse is more efficient...
Heuer-C
@Heuer-C
Mar 29 2017 07:38
@forkerino WAAAAAAAAAAAAAAAA amazing it does work thankyou but why this.id doesn't work ,dose there have something different?
CamperBot
@camperbot
Mar 29 2017 07:38
heuer-c sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 1743 | @forkerino |http://www.freecodecamp.com/forkerino
Markus Kiili
@Masd925
Mar 29 2017 07:38
@forkerino Array reverse way is insanely inefficient for long strings.
Rudy Hernandez
@rudolphh
Mar 29 2017 07:39
@forkerino it is in terms of readability, which is funny because i was taught to use recursion on a problem like this and it was funny when i really understood what we were checking
Pieter Stokkink
@forkerino
Mar 29 2017 07:40
@Masd925 good to know.
Markus Kiili
@Masd925
Mar 29 2017 07:41
@rudolphh if (str.length<2) return true; would be enough testing before recursive part.
Heuer-C
@Heuer-C
Mar 29 2017 07:41
@forkerino it seems that event can't be a parameter ,or it will still don't work
function changecolor(id){
document.getElementById(event.target.id).style.fontSize="30px";
}
Rudy Hernandez
@rudolphh
Mar 29 2017 07:42
@Masd925 yes indeed! ty
CamperBot
@camperbot
Mar 29 2017 07:42
rudolphh sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3686 | @masd925 |http://www.freecodecamp.com/masd925
Pieter Stokkink
@forkerino
Mar 29 2017 07:42
@Heuer-C you can find out by console.logging this or event in your function.
function changecolor(event){
document.getElementById(event.target.id).style.fontSize="30px";
}
this didn't work?!? @Heuer-C
Heuer-C
@Heuer-C
Mar 29 2017 07:43
and it also can work and if i don't set a parameter it also can work out
@forkerino yes
i have tried it
Pieter Stokkink
@forkerino
Mar 29 2017 07:44
@Heuer-C guess it has to be .style('font-size', '30px')
Heuer-C
@Heuer-C
Mar 29 2017 07:47
blob
@forkerino sorry ,i t still doesn't work
Markus Kiili
@Masd925
Mar 29 2017 07:48
@forkerino elem.style.fontSize = ... is correct syntax.
Heuer-C
@Heuer-C
Mar 29 2017 07:48
blob
it is ok !
blob
the" event" key word seems can't set it
Rudy Hernandez
@rudolphh
Mar 29 2017 07:49
has anyone done the pomodoro clock in react? i have one last issue and i think its implementation which is killing me
Heuer-C
@Heuer-C
Mar 29 2017 07:51
blob
Eunju
@Eunju-DICE
Mar 29 2017 07:52
hi can anyone help me with challenge "Stand in Line"?
Heuer-C
@Heuer-C
Mar 29 2017 07:52
this is also ok! it is my roommate's idea @forkerino thank u !
Markus Kiili
@Masd925
Mar 29 2017 07:52
@Eunju-DICE Sure, what have you done?
CamperBot
@camperbot
Mar 29 2017 07:52
heuer-c sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:warning: heuer-c already gave forkerino points
Eunju
@Eunju-DICE
Mar 29 2017 07:52
@Masd925 i cant figure anything out actually in this challenge
like what to do
Markus Kiili
@Masd925
Mar 29 2017 07:53
@Eunju-DICE Find out the two array methods you need and use them on arr and item (the function parameters that hold the passed array and number).
Rudy Hernandez
@rudolphh
Mar 29 2017 08:00
i like how @Masd925 put that. you got this @Eunju-DICE
Christopher
@bradley1492
Mar 29 2017 08:04
Hey,
I am just working on the Twitch API. I have just added some images of a JSON file in my second ajax success function. But the images appear only if I do not declare any sizing attribute for the <img> tag like width or height. Why aren't the images being resized properly? Here's my pen, I am talking specifically about line 31. Maybe someone can help.
https://codepen.io/bradley1492/pen/mWzObZ
Rudy Hernandez
@rudolphh
Mar 29 2017 08:09
@bradley1492 have you checked the console? a lot going on there
alpox
@alpox
Mar 29 2017 08:11
@bradley1492 You got a problem with your image tag string. you added width right on the url.
Use this instead: "<img src=\"" + streamdata.stream.channel.logo +"\" width='100' height='100'>";
@bradley1492 Also, please handle the case where streamdata or streamdata.stream are undefined
That's where the errors come from in the console
shreykmalhotra
@shreykmalhotra
Mar 29 2017 08:16
Hi, how to convert to celsius, what algorithm
devpaaji
@devpaaji
Mar 29 2017 08:16
@alpox
I have used a reset css
in which
 ol, ul {
  list-style: none;
}
Markus Kiili
@Masd925
Mar 29 2017 08:17
@shreykmalhotra Use the formula and function parameter celsius and assign the result to variable fahrenheit.
devpaaji
@devpaaji
Mar 29 2017 08:17
but when i redesigned by adding a new lis style
it does not capture
  .language-categories ul {
             list-style: circle; 
      }
shreykmalhotra
@shreykmalhotra
Mar 29 2017 08:18
thank you @Masd925
CamperBot
@camperbot
Mar 29 2017 08:18
shreykmalhotra sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3687 | @masd925 |http://www.freecodecamp.com/masd925
devpaaji
@devpaaji
Mar 29 2017 08:18
<div class="language-categories">
       <ul>
           <li><a href="/html/">HTML CSS</a></li> 
           <li><a href="/css/">PHP</a></li>
           <li><a href="/js/">Ruby</a></li>
           <li> <a href="/jquery/">Node JS</a></li>
           <li><a href="/jquery/">Design UI</a></li>
           <li> <a href="/jquery/">Web</a></li>
           <li> <a href="/jquery/">WordPress</a></li>
           <li> <a href="/jquery/">Entrepreneur</a></li>
           <li> <a href="/jquery/">Java</a></li>
       </ul>
    </div>
alpox
@alpox
Mar 29 2017 08:18
@devpaaji You probably meant list-style-type and not list-style
devpaaji
@devpaaji
Mar 29 2017 08:19
yes
list-style-type: square;
not getting applied
Markus Kiili
@Masd925
Mar 29 2017 08:19
@alpox list-style is a shorthand that works also.
devpaaji
@devpaaji
Mar 29 2017 08:20
This is the css reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
     margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline; 
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
 ol, ul {
  list-style: none;
}
ol, ul, li{
 margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline; 
}
curiousNoob
@curiousNoob
Mar 29 2017 08:22
Hi guys
Christopher
@bradley1492
Mar 29 2017 08:23
@rudolphh Hey, yes I know about the errors. Thats the next thing i have to get going. Somehow javascript is never getting all the requests right..
curiousNoob
@curiousNoob
Mar 29 2017 08:24
need your help. I have been tackling with this problem for more than hour. It is Exact Change from Advance Algorithm Challenge
checkCashRegister(3.26, 100.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return [["TWENTY", 60.00], ["TEN", 20.00], ["FIVE", 15.00], ["ONE", 1.00], ["QUARTER", 0.50], ["DIME", 0.20], ["PENNY", 0.04]] keeps failing. Here is the link:https://jsfiddle.net/do91m6qy/
Neil McCormack
@neilwoo83
Mar 29 2017 08:24

function reverseString(str) {
return str;
}

reverseString("hello");

Markus Kiili
@Masd925
Mar 29 2017 08:25
@devpaaji I would have guessed that the class rule would be more specific. Could you use id on the div? Would that matter?
Christopher
@bradley1492
Mar 29 2017 08:25
@alpox Hey thanks for the help. I just can't understand the structure of your solution.
"<img src=\"" + streamdata.stream.channel.logo +"\" width='100' height='100'>";
Especially the double quotations after the backslash after src...
CamperBot
@camperbot
Mar 29 2017 08:25
bradley1492 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 888 | @alpox |http://www.freecodecamp.com/alpox
Neil McCormack
@neilwoo83
Mar 29 2017 08:25
Can anybody help with a starting point with Reversing a string pls? styggling
struggling...

function reverseString(str) {
return str;
}

reverseString("hello");

Markus Kiili
@Masd925
Mar 29 2017 08:25
@curiousNoob Are you having rounding problems?
@neilwoo83 You can make a loop and a result string, or turn the string into an array and use array reverse method.
Recursion is also an option.
Neil McCormack
@neilwoo83
Mar 29 2017 08:26
Thanks. The problem for me is exactly this. Not knowing what tools to use where!
heroiczero
@heroiczero
Mar 29 2017 08:27
@neilwoo83 try using the reverse() method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse but remember this is an arr. Need to change the str into an array to use this method
Jor
@joreyesl
Mar 29 2017 08:27
@curiousNoob for pure js I would recommend https://repl.it/languages/javascript
Neil McCormack
@neilwoo83
Mar 29 2017 08:27
@heroiczero @Masd925 Thanks guys!
CamperBot
@camperbot
Mar 29 2017 08:27
neilwoo83 sends brownie points to @heroiczero and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1062 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 3688 | @masd925 |http://www.freecodecamp.com/masd925
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:34

function chunkArrayInGroups(arr, size) {
  var newArray = [];
  var push = [];
  for (index = 0; index < arr.length; index++){
    newArray = arr.slice(0, size);
  }




  return  newArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
for some reason, im drawing a blank on what to do next... any guidance would be nice
I'm assuming I have to push that sliced array into another array
but I might also need another for loop to go through and slice multiple parts of arr
Jor
@joreyesl
Mar 29 2017 08:36
@AbradolfLinclr yea that would be a good step, looks like you have an array defined push. you can push to that array. Also double check how you want index to be incremented
Markus Kiili
@Masd925
Mar 29 2017 08:36
@AbradolfLinclr Incrementing with index+=size would make it easier.
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:36
ahhh that makes so much more sense
Markus Kiili
@Masd925
Mar 29 2017 08:37
@AbradolfLinclr One result array is enough.
Jor
@joreyesl
Mar 29 2017 08:38
@AbradolfLinclr also, the start and end index to be used for slice will have to be dynamic. e.g. you dont want to use 0 and size except for the first one. what would be the start and end index for the 2nd array? can you come up with a pattern?
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:39
yea i already thought about that... thats why I thought i might have to start another for loop after my first slice
Jor
@joreyesl
Mar 29 2017 08:39
@AbradolfLinclr 1 loop is enough, you should be able to do all your slices there
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:40
oh yea you're right
Markus Kiili
@Masd925
Mar 29 2017 08:40
@AbradolfLinclr You just need to figure out the slice arguments, and push the slice.
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:40
alright im gonna fool aroudn with it a little bit
thanks guys
Jor
@joreyesl
Mar 29 2017 08:41
@AbradolfLinclr try to incorporate index in the argument since index will be changing as you loop
Rudy Hernandez
@rudolphh
Mar 29 2017 08:43
hopefully he doesn't see. improvements?
function chunkArrayInGroups(arr, size) {
  // Break it up.
  let myArr = [];
  for (let i =0; i< arr.length; i+=size){
    myArr.push(arr.slice(i,i+size));
  }
  return myArr;
}
i feel like there's a one-liner in there now :)
amanda
@amandak96
Mar 29 2017 08:44

Need some help! Im going to write a text with escape sequences written out. "FirstLine newline backslash SecondLine backslash carriage-return ThirdLine"

And here is my code: var myStr; "FirstLine\n\SecondLine\\rThirdLine";
but it doesn't work. What am i doing wrong?

Markus Kiili
@Masd925
Mar 29 2017 08:44
@rudolphh That is good.
Rudy Hernandez
@rudolphh
Mar 29 2017 08:44
@Masd925 ty
CamperBot
@camperbot
Mar 29 2017 08:44
rudolphh sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3689 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Mar 29 2017 08:45
@rudolphh There are one-liners, but all bad that I know of.
Rudy Hernandez
@rudolphh
Mar 29 2017 08:45
i'm sure you're right
Markus Kiili
@Masd925
Mar 29 2017 08:46
@rudolphh If you like one-liners, you can look at my gist of FCC challenge one-liners if you like.
Rudy Hernandez
@rudolphh
Mar 29 2017 08:46
@Masd925 yes please
Markus Kiili
@Masd925
Mar 29 2017 08:47
https://gist.github.com/Masd925/8b1a9b1d37c322827dcd
Rudy Hernandez
@rudolphh
Mar 29 2017 08:47
so sweet
Markus Kiili
@Masd925
Mar 29 2017 08:48
I left the worst ones out. Maybe should add them too for curiosity.
Jor
@joreyesl
Mar 29 2017 08:48

@curiousNoob i just tested your code. You have the correct values but for some reason it doesn't want to pass the challenge. One thing I did notice was that the expected array is in the reversed order. I changed this in your code return changeArr.reverse() and it passed.

This is not the first time I've seen someone having problem with the challenge. It may be a bug with the challenge.

Rudy Hernandez
@rudolphh
Mar 29 2017 08:48
you should. love the cards
even tweeted it lol
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:50
@rudolphh I wish I didn't see yours lol
Rudy Hernandez
@rudolphh
Mar 29 2017 08:51
@AbradolfLinclr was hoping you didn't ha
you're so close
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:52
@rudolphh i actually got my slice parameters correct... i just didnt know how to use the push method correctly
Rudy Hernandez
@rudolphh
Mar 29 2017 08:52
@AbradolfLinclr figured it was something like that; usually is.
AbradolfLinclr
@AbradolfLinclr
Mar 29 2017 08:52
i had newArray = newArray.push(arr.slice(index, index + size))
Markus Kiili
@Masd925
Mar 29 2017 08:53
@rudolphh I don't really like one-liners, but making them teaches you something sometimes.