These are chat archives for FreeCodeCamp/HelpJavaScript

6th
Jan 2017
Simon Cordova
@gbsimon87
Jan 06 2017 00:01 UTC
In about a month's time I'm going to start getting into the backend, any recommendations on what to learn first?
I've touched up on Python before but that was a while ago and barely remember it.
BoxOfCereal
@BoxOfCereal
Jan 06 2017 00:01 UTC
@HeebieGeeBee of all the things to blow a mill on
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:01 UTC
i know right, madness
Joseph
@revisualize
Jan 06 2017 00:02 UTC
@gbsimon87 Node.js?
Simon Cordova
@gbsimon87
Jan 06 2017 00:03 UTC
@sjames1958gm any suggestions as well?
Cheers @revisualize on the input btw
Are there any backend languages that are primarily used?
Stephen James
@sjames1958gm
Jan 06 2017 00:04 UTC
@gbsimon87 THat link shows some PHP - which is probably the majority language
Simon Cordova
@gbsimon87
Jan 06 2017 00:06 UTC
Is learning PHP a recommended approach these days, as oppose to say, learning Node.js first?
I once read an article that Python would be taking over, but this doesn't seem to be the case at all.
@peterito still need help?
Stephen James
@sjames1958gm
Jan 06 2017 00:09 UTC
@gbsimon87 I am not sure - nodejs is more interesting to me, but PHP might be more marketable
Simon Cordova
@gbsimon87
Jan 06 2017 00:11 UTC
When you say more marketable, do you mean it's used more so knowledge of it may be more benificial, at least for the moment?
beneficial**
peter oyebamiji
@peterito
Jan 06 2017 00:11 UTC
@gbsimon87 i cant stii figure out how to pass that challenge still giving me error
Simon Cordova
@gbsimon87
Jan 06 2017 00:11 UTC
@peterito post your code
Stephen James
@sjames1958gm
Jan 06 2017 00:12 UTC
@gbsimon87 yes
Simon Cordova
@gbsimon87
Jan 06 2017 00:12 UTC
@peterito use three backticks ( ` ). They're usually to the left of the 1 key. Then type your code, then put 3 backticks again.
@sjames1958gm hmm..interesting, that may be a route I'd like to take haha
peter oyebamiji
@peterito
Jan 06 2017 00:14 UTC

@gbsimon87
function nextInLine(arr, item) {
// Your code here
console.log([1,2,3], "paul");
nextInLine = arr.push(1);
// 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));

Simon Cordova
@gbsimon87
Jan 06 2017 00:15 UTC
@peterito, ok, so the first line in your code will look something like this...
Mike
@MikeJSchorah
Jan 06 2017 00:15 UTC
@gbsimon87 Could I ask you a question about your new job?
peter oyebamiji
@peterito
Jan 06 2017 00:16 UTC
@gbsimon87 just getting it wrong
Stephen James
@sjames1958gm
Jan 06 2017 00:16 UTC
@peterito nextInLine is the function name - not likely to be used inside the function.
use arr and item - first add item to end of arr - then remove the first value from arr and return it
webimdesign
@webimdesign
Jan 06 2017 00:17 UTC
Hello
Simon Cordova
@gbsimon87
Jan 06 2017 00:17 UTC
function nextInLine(arr, item) {
  elementToUse.methodToUse(whatToPushIntoTheElement);
}
webimdesign
@webimdesign
Jan 06 2017 00:17 UTC
Hello guys

Reverse the provided string.

You may need to turn the string into an array before you can reverse it.

Your result must be a string.

can anyone help me with this?
Stephen James
@sjames1958gm
Jan 06 2017 00:17 UTC
@webimdesign Did you look at the links for split and join?
Simon Cordova
@gbsimon87
Jan 06 2017 00:17 UTC
@MikeJSchorah sure whats up
Mike
@MikeJSchorah
Jan 06 2017 00:18 UTC
Is it easier than what's needed to do in the Intermediate Projects?
webimdesign
@webimdesign
Jan 06 2017 00:18 UTC

function reverseString(str) {
var array = str.split(" ");
array.reverse();
array.toString();
return array;
}

reverseString("hello");

i did this, but i don't know...
@sjames1958gm I did , i did the course too, but i am fucked up now
Stephen James
@sjames1958gm
Jan 06 2017 00:19 UTC
@webimdesign So to reverse you need to split on characters not words - so use '' not ' '
Simon Cordova
@gbsimon87
Jan 06 2017 00:20 UTC

@MikeJSchorah some of it is, and some isn't, it really depends on the project...
Tbh my job uses a lot of jquery and javascript, but not much algorithms, but don't deter on doing these algorithms.

To get better at my work I've returned to working on the algorithms, literally.

webimdesign
@webimdesign
Jan 06 2017 00:20 UTC
'not' instead of " " ?
Stephen James
@sjames1958gm
Jan 06 2017 00:20 UTC
@webimdesign Once you reverse the array - join is how you put it back together
@webimdesign '' empty string
Simon Cordova
@gbsimon87
Jan 06 2017 00:20 UTC
Using the methods correctly heavily increase my workflow.
Mike
@MikeJSchorah
Jan 06 2017 00:22 UTC
@gbsimon87 I was thinking about applying. I'm comfortable with everything up until the algorithms section. I understand how to do them now, same with the Intermediate Projects. I used an online tutorial to do the Intermediate Projects, but really spent some time analyzing them. I looked in a 200 mile search and it's saying that 600 junior developer jobs are available.
webimdesign
@webimdesign
Jan 06 2017 00:22 UTC
@sjames1958gm Thank you ,i understand now
CamperBot
@camperbot
Jan 06 2017 00:22 UTC
webimdesign sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5188 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
webimdesign
@webimdesign
Jan 06 2017 00:22 UTC
@sjames1958gm But it is not reversing the array...
Stephen James
@sjames1958gm
Jan 06 2017 00:23 UTC
@webimdesign When you use join it returns a string that you return
Simon Cordova
@gbsimon87
Jan 06 2017 00:23 UTC
@MikeJSchorah don't be afraid to apply, just don't water down your CV, if you don't know how to use a language, don't mark it down...
But if you feel comfortable with the intermediate projects and at least the beginner algorithms, i'd start applying for junior jobs
One tip I'll give you though, is take a separate course or two on DOM traversal.
Mike
@MikeJSchorah
Jan 06 2017 00:24 UTC
@gbsimon87 What do you do with the difficult parts of your job? How do you manage if you don't know something?
webimdesign
@webimdesign
Jan 06 2017 00:25 UTC
@sjames1958gm
function reverseString(str) {
var array = [];
array = str.split(' ');
array.reverse();
var arr = array.join(" ");
return arr;
}
what should i modify?
Stephen James
@sjames1958gm
Jan 06 2017 00:25 UTC
@webimdesign use empty string for both split and join
itsthomas
@itsthomas
Jan 06 2017 00:25 UTC

When I run this:

var myObject = {
    name: "Richard",
    age: 35,
    gender: "male"
};

for(i in myObject) {
    console.log(myObject[i]);
}

I get this in console:
Richard
35
male
undefined

What is the undefined??

Simon Cordova
@gbsimon87
Jan 06 2017 00:25 UTC
@MikeJSchorah honestly I research online.
Nobody knows all of the code anyway.
I was even on FCC asking help on the new HTML5 sliders and how to interact with them, which was a task I needed for a company client.
Stephen James
@sjames1958gm
Jan 06 2017 00:26 UTC
@itsthomas undefined is the result of the for loop
webimdesign
@webimdesign
Jan 06 2017 00:26 UTC
@sjames1958gm They are empty
Stephen James
@sjames1958gm
Jan 06 2017 00:26 UTC
@webimdesign no they are not - they have 1 space which is not the same as empty
itsthomas
@itsthomas
Jan 06 2017 00:26 UTC
@sjames1958gm , but why I get it? What is wrong in that code?
Mike
@MikeJSchorah
Jan 06 2017 00:26 UTC
@gbisimon Do you use Stack Overflow? I tried using it a year ago, but if you don't get points, they will suspend your account for a few days.
webimdesign
@webimdesign
Jan 06 2017 00:27 UTC
@sjames1958gm Oh my god :)) thank you bro :))
CamperBot
@camperbot
Jan 06 2017 00:27 UTC
:warning: webimdesign already gave sjames1958gm points
webimdesign sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Stephen James
@sjames1958gm
Jan 06 2017 00:27 UTC
@itsthomas nothing - the console outputs the result of the last expression and the result of for loop is undefined
Addacus
@Addacus
Jan 06 2017 00:27 UTC

2
function nextInLine(arr, item) {
3
// Your code here
4
var removed = arr[0];
5
arr.push(item);
6
arr.shift();
7
return removed; // Change this line
8
}
9

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

13
// Display Code
14
console.log("Before: " + JSON.stringify(testArr));
15
console.log(nextInLine(testArr, 6)); // Modify this line to test
16
console.log("After: " + JSON.stringify(testArr));
17
Stephen James
@sjames1958gm
Jan 06 2017 00:27 UTC
@webimdesign :+1:
webimdesign
@webimdesign
Jan 06 2017 00:27 UTC
I just did't see , I am so blind
@sjames1958gm :))
Addacus
@Addacus
Jan 06 2017 00:27 UTC
That looks gross, how do I post a clip of my code like everyone else?
Stephen James
@sjames1958gm
Jan 06 2017 00:27 UTC
@Addacus you need to return the first element after the push not before
@Addacus '''
CamperBot
@camperbot
Jan 06 2017 00:27 UTC
:bulb: to format code use backticks! ``` more info
eeflores
@eeflores
Jan 06 2017 00:27 UTC
@itsthomas even if you do a simple statement like a console.log that doesn't return a value you'll get an undefined
Stephen James
@sjames1958gm
Jan 06 2017 00:27 UTC
click that more info link above
itsthomas
@itsthomas
Jan 06 2017 00:28 UTC
@sjames1958gm and @eeflores doe’s it mean that what ever I run in I get an undefined in the console at the end of the result?
Addacus
@Addacus
Jan 06 2017 00:28 UTC
@sjames1958gm But then wouldn't I be returning the first element of the new array, not the removed?
Stephen James
@sjames1958gm
Jan 06 2017 00:29 UTC
@itsthomas I was incorrect - the result of the for loop is the result of last iteration of the for loop.
but console.log returns undefined so that is the result of the for loop
@Addacus which is what you are supposed to do - so that [], 1 will return 1 (push 1 then shift 1)
Addacus
@Addacus
Jan 06 2017 00:32 UTC
I am still thoroughly confused
itsthomas
@itsthomas
Jan 06 2017 00:32 UTC
Whenever I run console.log(“some text”); the last thing I see in the console is undefined. I still don’t understand why?? :-(
Sam Griffen
@ssgriffen
Jan 06 2017 00:32 UTC
Anyone know why my links arent working? http://codepen.io/ssgriffen/pen/VmOKEp
David Halls
@DavidHalls
Jan 06 2017 00:33 UTC
can i get some feed back on this please http://codepen.io/Byzgig/full/rWpdKN/
Dan Couper
@DanCouper
Jan 06 2017 00:33 UTC
@gbsimon87 PHP is pretty awful, but it was the only option for a very long time, and is available almost everywhere. Python is a much better language; Ruby as well. Node is very widely used, Go is getting there as well. Java/C# still king for enterprise. Knowing any language well will get you a job, because someone who knows one language well can be easily trained to use another language, but there is likely to be a slight bias against PHP for anything serious, probably due to it historically being a very bad language with a low bar to entry (like JS), and WordPress. Note knowing what languages are good for is useful, and lets you focus on what you want to do; Node for small, fast, lightweight apps with high throughput (APIs for example), Python for data stuff, Python/Ruby for midrange apps w/ small teams, Java/C# for heavyweight enterprise stuff, Go for APIs. PHP for agencies (WordPress) and legacy business stuff that businesses can't afford to dump. C/C++ for systems stuff. C++ for games. Then a few things that are useful in different specific ways - Erlang/Elixir for distributed, extremely fault-tolerant programming, Swift for IOS development, Haskell for deeply understanding typed functional stuff, Scala for heavy data stuff, Lua for embedded scripting, Rust as an alternative to C, Bash for general scripting (PowerShell also useful on Windows), and SQL is generally v useful to know. Clojure is nice, and is a Lisp, and it is useful to have an understanding of what Lisp is and how it works.
Addacus
@Addacus
Jan 06 2017 00:34 UTC
'''
CamperBot
@camperbot
Jan 06 2017 00:34 UTC
:bulb: to format code use backticks! ``` more info
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:36 UTC
is there a way to do auto closing tags in atom?
Addacus
@Addacus
Jan 06 2017 00:37 UTC

function nextInLine(arr, item) {
  // Your code here
  var removed = arr[0];
  arr.push(item);
  arr.shift();
  return removed;  // 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));
I feel really dumb, because it still looks right to me and I can't figure out what you mean to save my life.
Mike
@MikeJSchorah
Jan 06 2017 00:37 UTC
Thanks @gbsimon87
CamperBot
@camperbot
Jan 06 2017 00:37 UTC
mikejschorah sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:cookie: 381 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
David Halls
@DavidHalls
Jan 06 2017 00:38 UTC
@Addacus not quite, but close
Jason Luboff
@JLuboff
Jan 06 2017 00:39 UTC
@DanCouper Whats your opinion of Visual Basic? I'm working on learning only due to the fact that we have several built inhouse apps that were written in VB (they link into our SQL servers as well)
Simon Cordova
@gbsimon87
Jan 06 2017 00:39 UTC
@DanCouper thank you very very much for such a detailed response, I'm going to actually save that
CamperBot
@camperbot
Jan 06 2017 00:39 UTC
gbsimon87 sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 435 | @dancouper |http://www.freecodecamp.com/dancouper
Simon Cordova
@gbsimon87
Jan 06 2017 00:39 UTC
@MikeJSchorah no worries man :)
Mike
@MikeJSchorah
Jan 06 2017 00:40 UTC
Could someone please tell me how to get started on the Roman Numeral Converter? I don't have a clue. I spent 1/2 hour thinking about it
Carlos
@jeancarlospena
Jan 06 2017 00:41 UTC
function addTogether(a, b) {
  return a + b;
}
addTogether(2)(3);
i have never dealt with anything like this. how i am supposed to get the values?
Stephen James
@sjames1958gm
Jan 06 2017 00:41 UTC
@itsthomas console.log returns undefined
itsthomas
@itsthomas
Jan 06 2017 00:41 UTC
@sjames1958gm thanks
CamperBot
@camperbot
Jan 06 2017 00:41 UTC
itsthomas sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:41 UTC
atom is overwhelming me
CamperBot
@camperbot
Jan 06 2017 00:41 UTC
:star2: 5189 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Addacus
@Addacus
Jan 06 2017 00:41 UTC

function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  var removed = arr[0];
  arr.shift();
  return removed;  // 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));
Figured it out, thanks.. I feel stupid, lol
Dan Couper
@DanCouper
Jan 06 2017 00:41 UTC
@JLuboff I’ve never used it tbh, I use C# at work which uses the same system underneath, but I don’t know how different it is - the only thing I really know about it is that it’s fairly simple, and is pretty widely used by business analysts to write Excel macros - this alone kinda puts me off even investigating it. Seems extremely business-ey, so I avoid ;)
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:41 UTC
theres too much too quick
Stephen James
@sjames1958gm
Jan 06 2017 00:42 UTC
@carloslocoo When the function is passed only one value (2) it returns a function which gets called with (3)
Jason Luboff
@JLuboff
Jan 06 2017 00:42 UTC
@DanCouper I'm guessing you probably don't know how difficult it would be to rework from VB to c# then?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:42 UTC
@MikeJSchorah first think to do is to determine how many digits a particular number has
Mike
@MikeJSchorah
Jan 06 2017 00:43 UTC
Thanks @HeebieGeeBee
Carlos
@jeancarlospena
Jan 06 2017 00:43 UTC
@sjames1958gm i undestand that but in the "Arguments Optional" challenge that's how they insert it.
CamperBot
@camperbot
Jan 06 2017 00:43 UTC
mikejschorah sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: mikejschorah already gave heebiegeebee points
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 00:43 UTC
then convert all the thousend digits if it has any, then convert the hundred digits if it has any and so on
Stephen James
@sjames1958gm
Jan 06 2017 00:43 UTC
@MikeJSchorah What I did was take a given decimal number and went through the process of converting it by hand to a roman number
Mike
@MikeJSchorah
Jan 06 2017 00:43 UTC
Thanks @sjames1958gm
CamperBot
@camperbot
Jan 06 2017 00:43 UTC
mikejschorah sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: mikejschorah already gave sjames1958gm points
Mike
@MikeJSchorah
Jan 06 2017 00:44 UTC
I ran out of points to give, I am a loser
Stephen James
@sjames1958gm
Jan 06 2017 00:44 UTC
@Addacus BTW - return arr.shift() would have done the same
Simon Cordova
@gbsimon87
Jan 06 2017 00:44 UTC
@DanCouper @sjames1958gm thanks guys, seems like I'll be starting with PHP
CamperBot
@camperbot
Jan 06 2017 00:44 UTC
gbsimon87 sends brownie points to @dancouper and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: gbsimon87 already gave dancouper points
:warning: gbsimon87 already gave sjames1958gm points
Dan Couper
@DanCouper
Jan 06 2017 00:44 UTC
@JLuboff because it uses the same underlying system, I assume you should be able to replace bits piecemeal, and they will still all work together - the syntax is extremely similar, but C# looks a helluva lot more robust overall, but it looks like you can just replace class by class/module by module and the VB & C# should all work together
Stephen James
@sjames1958gm
Jan 06 2017 00:44 UTC
@carloslocoo Then I am not sure what you are asking - I thought you mean how do you get (3) in the function
jakobmara
@jakobmara
Jan 06 2017 00:45 UTC

function titleCase(str) {
var newWord = str.split(' ');
var check = newWord.length;

for (var i = 0; i < check; i++) {
newWord[i][0] = newWord[i][0].toUpperCase;
var check2 = newWord[i].length;
for (var x = 1; x < check2; x++){
newWord[i][x] = newWord[i][x].toLowerCase;
}
}

return newWord;
}

titleCase("I'm a little tea pot");

'''
CamperBot
@camperbot
Jan 06 2017 00:45 UTC
:bulb: to format code use backticks! ``` more info
jakobmara
@jakobmara
Jan 06 2017 00:45 UTC
'''
CamperBot
@camperbot
Jan 06 2017 00:45 UTC
:bulb: to format code use backticks! ``` more info
jakobmara
@jakobmara
Jan 06 2017 00:45 UTC

'''

function titleCase(str) {
var newWord = str.split(' ');
var check = newWord.length;

for (var i = 0; i < check; i++) {
newWord[i][0] = newWord[i][0].toUpperCase;
var check2 = newWord[i].length;
for (var x = 1; x < check2; x++){
newWord[i][x] = newWord[i][x].toLowerCase;
}
}

return newWord;
}

titleCase("I'm a little tea pot");
'''

CamperBot
@camperbot
Jan 06 2017 00:45 UTC
:bulb: to format code use backticks! ``` more info
Stephen James
@sjames1958gm
Jan 06 2017 00:45 UTC
@jakobmara toUpperCase this is a function - but you are not calling it
@jakobmara use ```
Jason Luboff
@JLuboff
Jan 06 2017 00:45 UTC
@DanCouper Thanks. I think I'll try my best at VB, at least so I understand what is going on in the current source code and maybe work my way up to C# :)
CamperBot
@camperbot
Jan 06 2017 00:45 UTC
jluboff sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 436 | @dancouper |http://www.freecodecamp.com/dancouper
jakobmara
@jakobmara
Jan 06 2017 00:45 UTC
ohhh
function titleCase(str) {
  var newWord = str.split(' ');
  var check = newWord.length;

  for (var i = 0; i < check; i++) {
  newWord[i][0] = newWord[i][0].toUpperCase;
  var check2 = newWord[i].length;
    for (var x = 1; x < check2; x++){
      newWord[i][x] = newWord[i][x].toLowerCase;
    }
}

  return newWord;
}

titleCase("I'm a little tea pot");
Carlos
@jeancarlospena
Jan 06 2017 00:46 UTC
@sjames1958gm how do i get the function that said it returns?
jakobmara
@jakobmara
Jan 06 2017 00:46 UTC
thanks @sjames1958gm
CamperBot
@camperbot
Jan 06 2017 00:46 UTC
jakobmara sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5190 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 06 2017 00:47 UTC
@carloslocoo You write the function
  function test() {
     return function () {}
}
Dan Couper
@DanCouper
Jan 06 2017 00:47 UTC
@JLuboff I’ve only been using C# for 6 months, it’s honestly not that difficult - it’s built so that new programmers can be trained up in it easily (like Java), what is overwhelming is the sheer size of the language ecosystem more than anything else. The type system catches a lot of issues (it just flat out stops you doing some of the stupid stuff you can do in, for example, JavaScript), and Visual Studio (especially with Resharper) is a pretty excellent (if often jarringly slow) tool
webimdesign
@webimdesign
Jan 06 2017 00:47 UTC
@sjames1958gm Hei : Return true if the given string is a palindrome. Otherwise, return false.

function palindrome(str) {
// Good luck!

var array = [];
array = str.split("");
array.reverse();
var arr = array.join("");
var palindrom = arr;
palindrom.toLowerCase();
var newstr = palindrom.replace(/ _!@#$%^&*()/gi,'');

if(newstr===str){
return true;
}

return false;
}

palindrome("eye");

Is working, but it need to be working for thigs like : _eye and eye @sjames1958gm
to ignore _%#@!#@!*#! caracters
babajide odusola
@cesarecaravaggio
Jan 06 2017 00:49 UTC
guys whats going on with my code?
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
myArray.unshift(["paul", 35]);
is it the parenthesis
Jason Luboff
@JLuboff
Jan 06 2017 00:50 UTC
@DanCouper Well I'm still relatively new to programming in and of itself. I started FCC about 6 months ago. I'm up to the Pomodoro clock and only haven't finished that due to a project I built for work (Digital conference room sign). However, while I'm starting to get more intune and understanding better...I feel there is still a hell of a lot I'm not understanding haha. I'm working on finding other sources (books) to read up on and get a better understanding of the Javascript ecosystem and at the same time, VB (and SQL)...and eventually whatever other programs I'd feel are useful.
@cesarecaravaggio I'm guessing that Paul should be capitialized
Stephen James
@sjames1958gm
Jan 06 2017 00:51 UTC
@webimdesign Maybe remove all the special characters and toLowerCase before you split/join
@cesarecaravaggio The code wants Paul
jakobmara
@jakobmara
Jan 06 2017 00:52 UTC
try this @cesarecaravaggio myArray.unshift(["Paul", 35]);
Dan Couper
@DanCouper
Jan 06 2017 00:53 UTC
@JLuboff Just whatever language is good I think - JS, VB and SQL gives a pretty nice basis, and the more you learn of each will feed into you learning the others. And it’s always really painful at first :). Just the fact you’re building actual real things is a massive, massive thing because it forces you to learn quickly. And once you know any of them well, learning other languages gets exponentially easier
jakobmara
@jakobmara
Jan 06 2017 00:53 UTC
tell me if that works if so I know the problem
babajide odusola
@cesarecaravaggio
Jan 06 2017 00:53 UTC
@JLuboff @sjames1958gm right thanks for the correction guys!
CamperBot
@camperbot
Jan 06 2017 00:53 UTC
cesarecaravaggio sends brownie points to @jluboff and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 575 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 5191 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
babajide odusola
@cesarecaravaggio
Jan 06 2017 00:53 UTC
@jakobmara yeah i got that aha didnt look hard enough i guess.
Jason Luboff
@JLuboff
Jan 06 2017 00:54 UTC
@DanCouper Exactly. I'm going to keep on going....keep on learning...and just keep doing my best! The pain will eventually subside haha
webimdesign
@webimdesign
Jan 06 2017 00:54 UTC
@sjames1958gm It is still not working
Dan Couper
@DanCouper
Jan 06 2017 00:56 UTC
@JLuboff Then you’ll use another language, and be like "why the hell was I using JS/VB for so long! This new language fixes all of the problems I had in those other languages"…and then the cycle will continue
Jason Luboff
@JLuboff
Jan 06 2017 00:58 UTC
:laughing: I look forward to it. And on that note, I am out for the evening. See everybody tomorrow
Simon Cordova
@gbsimon87
Jan 06 2017 00:59 UTC
Off to bed, night guys...
brunoallenbjj
@brunoallenbjj
Jan 06 2017 01:01 UTC
Variable myStr should contain the string: I am a "double quoted" string inside "double quotes". my , code is : var myStr= "I am a \"double quoted\" string inside \"double quotes\"";
where is the problem
??
uriznik
@uriznik
Jan 06 2017 01:01 UTC
@brunoallenbjj missing full stop at the end?
brunoallenbjj
@brunoallenbjj
Jan 06 2017 01:03 UTC
it is complete ..
brunoallenbjj
@brunoallenbjj
Jan 06 2017 01:08 UTC
@uriznik thanks bro
CamperBot
@camperbot
Jan 06 2017 01:08 UTC
:cookie: 444 | @uriznik |http://www.freecodecamp.com/uriznik
brunoallenbjj sends brownie points to @uriznik :sparkles: :thumbsup: :sparkles:
Stephen James
@sjames1958gm
Jan 06 2017 01:22 UTC
@webimdesign Sorry was off line for a bit, where are you now
webimdesign
@webimdesign
Jan 06 2017 01:23 UTC

@sjames1958gm Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.

For the purpose of this exercise, you should also capitalize connecting words like "the" and "of".

Sara Dorris
@saralee233
Jan 06 2017 01:25 UTC
not quite sure of how to declare the local variable myVar inside myLocalScope
function myLocalScope() {
  'use strict';
  var loc = "myVar";

  console.log(loc);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(loc); // "undefined"

// Now remove the console log line to pass the test
Johnny
@JohnnyBizzel
Jan 06 2017 01:26 UTC

@saralee233

function myLocalScope() {
  'use strict';
  var myVar = 0;

  console.log(myVar);
}
myLocalScope();

Maybe like this?

Victor Rose
@vicdrose
Jan 06 2017 01:27 UTC
man this is awesome but also difficult
to do in spare time, you need to really dedicate time. How have some of you gotten through FCC
Johnny
@JohnnyBizzel
Jan 06 2017 01:27 UTC
@vicdrose That's the fun :exclamation:
Victor Rose
@vicdrose
Jan 06 2017 01:28 UTC
any time management tips?
Johnny
@JohnnyBizzel
Jan 06 2017 01:28 UTC
@vicdrose Do a little every day if you can.
Victor Rose
@vicdrose
Jan 06 2017 01:28 UTC
gotcha
What's your background? What do you do?
Johnny
@JohnnyBizzel
Jan 06 2017 01:28 UTC
@vicdrose And pair programming works for me

What's your background? What do you do?

Who me?

Sara Dorris
@saralee233
Jan 06 2017 01:29 UTC
@JohnnyBizzel thanks! how did you know to set myVar = to 0?
CamperBot
@camperbot
Jan 06 2017 01:29 UTC
saralee233 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1097 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Victor Rose
@vicdrose
Jan 06 2017 01:29 UTC
@JohnnyBizzel yea
Stephen James
@sjames1958gm
Jan 06 2017 01:29 UTC
@webimdesign toLowerCase the string break into words then process each word
Johnny
@JohnnyBizzel
Jan 06 2017 01:29 UTC
@saralee233 Guess. I don't think it matters. What matters is the scope of where it is.
Victor Rose
@vicdrose
Jan 06 2017 01:29 UTC
@JohnnyBizzel that a good suggestion, I could try to get a partner
webimdesign
@webimdesign
Jan 06 2017 01:29 UTC
@sjames1958gm I know but i don't get it
Johnny
@JohnnyBizzel
Jan 06 2017 01:30 UTC
@vicdrose Ex Software Developer - C#. Now full time studying on FCC.
Stephen James
@sjames1958gm
Jan 06 2017 01:30 UTC
@webimdesign Take it step by step -
Johnny
@JohnnyBizzel
Jan 06 2017 01:30 UTC
@saralee233 The variable is only available inside it's own function. This is "scope".
@vicdrose The forum is good, plus the LetsPair room.
@vicdrose Your site has :notes: music! :D
webimdesign
@webimdesign
Jan 06 2017 01:33 UTC

@sjames1958gm function titleCase(str) {
var title;
var cuvant;
var bunica=str.split(" ");
for(var i=0;i<bunica.length;i++){
cuvant=bunica[i];
for(var j=0;j<cuvant;j++){
title+=cuvant[j];

}

}
return bunica;
}

not working
Johnny
@JohnnyBizzel
Jan 06 2017 01:34 UTC

@webimdesign

 function titleCase(str) {
var title;
var cuvant;
var bunica=str.split(" ");
for(var i=0;i<bunica.length;i++){
cuvant=bunica[i];
for(var j=0;j<cuvant;j++){
title+=cuvant[j];
}
}
return bunica;
}

formatted for you.
Does Title Case Mean Like This?

Carlos
@jeancarlospena
Jan 06 2017 01:34 UTC
what do you guys prefer list or listless nav?
webimdesign
@webimdesign
Jan 06 2017 01:34 UTC
@JohnnyBizzel how can I send like you did? in this format?
Johnny
@JohnnyBizzel
Jan 06 2017 01:34 UTC
'''
CamperBot
@camperbot
Jan 06 2017 01:34 UTC
:bulb: to format code use backticks! ``` more info
Johnny
@JohnnyBizzel
Jan 06 2017 01:35 UTC
^^ see here
Keep ticks code and closing ticks on separate lines
Doegena Fennich
@Doegena
Jan 06 2017 01:35 UTC
Gonna go back to Teamtreehouse to take the js course and build some random projects, hopefully after a while i can rush through the rest of the Js challenges, getting stuck to often.
Carlos
@jeancarlospena
Jan 06 2017 01:36 UTC
it's not ' it's `, the one with ~
Johnny
@JohnnyBizzel
Jan 06 2017 01:36 UTC
@carloslocoo Depends which type of keyboard you are using.
Mind is next to 1
webimdesign
@webimdesign
Jan 06 2017 01:37 UTC
@JohnnyBizzel
@JohnnyBizzel thanks
CamperBot
@camperbot
Jan 06 2017 01:37 UTC
webimdesign sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Sara Dorris
@saralee233
Jan 06 2017 01:37 UTC
when looking at a code how can you differentiate between a global and local variable
CamperBot
@camperbot
Jan 06 2017 01:37 UTC
:star2: 1099 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Jan 06 2017 01:37 UTC
@webimdesign Anytime ;)
@saralee233 Global vars are normally placed at the top of a code block.
Also they are not inside a function call.
webimdesign
@webimdesign
Jan 06 2017 01:38 UTC
 console.log("Thanks");
agustashd
@agustashd
Jan 06 2017 01:38 UTC
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"] } ]; var a = contacts[0]["firstName"]; //return Akira var b = contacts[0].hasOwnProperty("Akira"); //return false var c = contacts.hasOwnProperty("Akira"); //return false
How can i correct the syntax in order to get a true statement out of .hasOwnProperty() variables b and c are what i think is correct but i'm getting false instead
Johnny
@JohnnyBizzel
Jan 06 2017 01:38 UTC
@agustashd
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"] } ]; 
var a = contacts[0]["firstName"]; 
//return Akira 
var b = contacts[0].hasOwnProperty("Akira"); 
//return false 
var c = contacts.hasOwnProperty("Akira"); 
//return false
webimdesign
@webimdesign
Jan 06 2017 01:38 UTC
@sjames1958gm could you help?
agustashd
@agustashd
Jan 06 2017 01:38 UTC
How can i fix that so it displays correctly?
Sara Dorris
@saralee233
Jan 06 2017 01:39 UTC
@JohnnyBizzel thanks again!
CamperBot
@camperbot
Jan 06 2017 01:39 UTC
saralee233 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:warning: saralee233 already gave johnnybizzel points
Johnny
@JohnnyBizzel
Jan 06 2017 01:39 UTC
@saralee233 ;) You will see the difference easily with practice.
Global vars are not used so much.
agustashd
@agustashd
Jan 06 2017 01:42 UTC
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"]
    }
];
var a = contacts[0]["firstName"];
var b = contacts[0].hasOwnProperty("Akira");
var c = contacts.hasOwnProperty("Akira");
webimdesign
@webimdesign
Jan 06 2017 01:42 UTC

@JohnnyBizzel could you help

function titleCase(str) {
  var title="";
  var cuvant;
  var bunica=str.split(" ");
  for(var i=0;i<bunica.length;i++){
    cuvant=bunica[i];
    title=+cuvant[0];

  }
  return title;
}

titleCase("I'm a little tea pot");

It says i have to create a title with the first letter of every word

agustashd
@agustashd
Jan 06 2017 01:42 UTC
How can i correct the syntax in order to get a true statement out of .hasOwnProperty() variables b and c are what i think is correct but i'm getting false instead
what i think could be correct*
Johnny
@JohnnyBizzel
Jan 06 2017 01:43 UTC
@webimdesign IS there a uppercase function?
grantknaver
@grantknaver
Jan 06 2017 01:43 UTC
why is this not returning the prime numbers. My rational is : i goes through every number up to the argument number; and tests to see if generates 0 when set against a modulus of j. If so it is supposed to push that number to the array named answer. Here is my code.
grantknaver
@grantknaver
Jan 06 2017 01:44 UTC
function sumPrimes(num) {
var answer = [];
 for (var i = 1; i <= num; i++){
   for(var j = 1; j <=num; j++){
     if (i > 1 && i % j === 0){
       answer.push(i);
     }
   }
 }
   return answer;
}

sumPrimes(10);
webimdesign
@webimdesign
Jan 06 2017 01:44 UTC
@JohnnyBizzel Something like , but , it is correct what i've write?
grantknaver
@grantknaver
Jan 06 2017 01:44 UTC
here is the assignment
Johnny
@JohnnyBizzel
Jan 06 2017 01:44 UTC
@agustashd var b = contacts[0].hasOwnProperty("Akira"); // "Akira" is a value not a property
Sara Dorris
@saralee233
Jan 06 2017 01:45 UTC

// Setup
var outerWear = "T-Shirt";

function myOutfit() {
  // Only change code below this line
  var myOutfit = "sweater";


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

myOutfit();
I'm just struggling with the concept of how to understand how to add a local variable
Johnny
@JohnnyBizzel
Jan 06 2017 01:46 UTC
@grantknaver When I googled how to find a Prime number I found this function
function check_prime(a)
{
   var c = 2;
   for ( c = 2 ; c <= a - 1 ; c++ )
   { 
      if ( a % c === 0 )
           return false;
   }
   if ( c === a )
      return true;
}
@saralee233 var outerWear = "T-Shirt"; is a global variable because it is available to all remaining code.
grantknaver
@grantknaver
Jan 06 2017 01:47 UTC
you have any idea what is wrong with my code
and thanks that might give me something to go off of
Johnny
@JohnnyBizzel
Jan 06 2017 01:48 UTC
@grantknaver run it through pythontutor
agustashd
@agustashd
Jan 06 2017 01:48 UTC
@JohnnyBizzel indeed it is, i'll check now if i can solve the challenge
Johnny
@JohnnyBizzel
Jan 06 2017 01:48 UTC
@grantknaver You are creating a massive array
Sara Dorris
@saralee233
Jan 06 2017 01:49 UTC
@JohnnyBizzel I was close...i just did not look at the details close enough
Johnny
@JohnnyBizzel
Jan 06 2017 01:49 UTC
@saralee233 :eyes: :D
grantknaver
@grantknaver
Jan 06 2017 01:50 UTC
@JohnnyBizzel Ok how
Johnny
@JohnnyBizzel
Jan 06 2017 01:50 UTC
@grantknaver also that array includes non prime numbers
First make an array of Primes with the function I gave you.
(I think I googled that too!)
grantknaver
@grantknaver
Jan 06 2017 01:52 UTC
Ok I am going have to think about this thanks
Farah Soltane
@chokolate
Jan 06 2017 01:53 UTC
@johnnunns im stuk at the same thing
Johnny
@JohnnyBizzel
Jan 06 2017 01:53 UTC
@grantknaver It is a tricky one to test as the big number can create a big array.
grantknaver
@grantknaver
Jan 06 2017 01:54 UTC
OK OK ill get this. The tricky ones are where you learn
Sander Berntsen
@sbxn14
Jan 06 2017 01:55 UTC
anyone know how I can assign my js for scrolling to the button in the middle of the screen? im a huge newbie when it comes to js and I donno how to do it myself.. http://codepen.io/sbxn14/pen/egmKRr
Johnny
@JohnnyBizzel
Jan 06 2017 01:55 UTC
@grantknaver The prime array form (10) should be [2, 3,5,7], sum = 17
Zak
@zaksanderford
Jan 06 2017 01:56 UTC
In the Profile Lookup exercise, can the complex object be thought of as an array in an array? So if I match on the firstName can I iterate over the remaining properties associated with that firstName with a loop?
Johnny
@JohnnyBizzel
Jan 06 2017 01:56 UTC
@sbxn14 Paralax scroll?
sega1219
@sega1219
Jan 06 2017 01:56 UTC

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

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

 return checkProp;} else if(false)
  return "Not Found";
  }
}

// Test your code by modifying these values
checkObj("gift");
what is wrong with my code?
Sander Berntsen
@sbxn14
Jan 06 2017 01:57 UTC
@JohnnyBizzel I honestly got no clue. im using a code I found on github and it works great for my navbar but I also want it to work with the extra button i added in the middle of my cover.
Sander Berntsen
@sbxn14
Jan 06 2017 01:57 UTC
@JohnnyBizzel ```
Joseph
@revisualize
Jan 06 2017 01:57 UTC
@sega1219 true is always true
Sander Berntsen
@sbxn14
Jan 06 2017 01:57 UTC
$(document).ready(function() {
  $('.nav a').on('click', function(e) {
    e.preventDefault();

    var target = $(this).attr('href'),
      offset = $(target).offset().top - 70;

    $('html, body').stop().animate({
      scrollTop: offset
    }, 500);
  });
$('.scroll ul li').click(function(e) {
  var $this = $(this);
  var prev = $(this).parent().find('.active');
  prev.removeClass('active');
  if (!$this.hasClass('active')) {
    $this.addClass('active');
  }
  e.preventDefault();
});
});
thats my current code.
how do I modify it so that it picks up the button aswell
sega1219
@sega1219
Jan 06 2017 01:58 UTC
@revisualize thank you
CamperBot
@camperbot
Jan 06 2017 01:58 UTC
:star2: 2855 | @revisualize |http://www.freecodecamp.com/revisualize
Sander Berntsen
@sbxn14
Jan 06 2017 01:58 UTC
thats my button
CamperBot
@camperbot
Jan 06 2017 01:58 UTC
sega1219 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
Sander Berntsen
@sbxn14
Jan 06 2017 01:58 UTC
 <a href="#about" class="btn btn-circle page-scroll">
        <i class="fa fa-angle-double-down animated"></i>
      </a>
Johnny
@JohnnyBizzel
Jan 06 2017 01:58 UTC
@sega1219 if (true) // always true!
Carlos
@jeancarlospena
Jan 06 2017 01:58 UTC
function addTogether() {
  var args = Array.from(arguments);
  return args.some(n => typeof n !== 'number') ? 
    undefined: 
    args.length > 1 ?
      args.reduce((acc, n) => acc += n, 0):
      (n) => typeof n === "number" ? 
        n + args[0]:
        undefined;
}
addTogether(2,3);
is anyone here advanced enough to understand the code above?
Joseph
@revisualize
Jan 06 2017 01:59 UTC
@carloslocoo Research Currying.
Sander Berntsen
@sbxn14
Jan 06 2017 01:59 UTC
I love curry
Johnny
@JohnnyBizzel
Jan 06 2017 01:59 UTC
@revisualize I like a good curry :yum:
Sander Berntsen
@sbxn14
Jan 06 2017 01:59 UTC
but can you help ? with the info i gave? @JohnnyBizzel
Johnny
@JohnnyBizzel
Jan 06 2017 02:00 UTC
@sbxn14 So you don't want a Parallax scroll? :/
Sander Berntsen
@sbxn14
Jan 06 2017 02:00 UTC
@JohnnyBizzel uh no I just want it to have the same scroll effect as i have on the navbar
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:00 UTC
var gloveBoxContents = myStorage.inside["glove box"];
Sander Berntsen
@sbxn14
Jan 06 2017 02:00 UTC
but I dont know hwo to connect it
Joseph
@revisualize
Jan 06 2017 02:00 UTC
@nehamchangappa You're missing the car
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:00 UTC
@sbxn14 do you realise youre using a picture thats almost 13mb as a header?
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:01 UTC
@revisualize thanks
CamperBot
@camperbot
Jan 06 2017 02:01 UTC
nehamchangappa sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2856 | @revisualize |http://www.freecodecamp.com/revisualize
Sander Berntsen
@sbxn14
Jan 06 2017 02:01 UTC
@HeebieGeeBee is that bad?
Fernando
@fer408
Jan 06 2017 02:01 UTC

i am having some trouble with this algorithm. I get the test cases from true but not for false.
function mutation(arr) {
var sampleA = arr.slice(0,1);
var sampleB = arr.slice(-1);
if(sampleA.indexOf(sampleA.length) == sampleB.indexOf(sampleB.length)) {
return true;
}
else
{
return false;
}

}

HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:01 UTC
yes, very
sega1219
@sega1219
Jan 06 2017 02:01 UTC
how would I have only the value of a property returned?
Sander Berntsen
@sbxn14
Jan 06 2017 02:01 UTC
@HeebieGeeBee how do i make it smaller
Joseph
@revisualize
Jan 06 2017 02:01 UTC
@sega1219 How do you access an object property?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:01 UTC
you need to lower the quality
Sander Berntsen
@sbxn14
Jan 06 2017 02:02 UTC
but but I just finally got the picture to work after 3 hours :(
sega1219
@sega1219
Jan 06 2017 02:02 UTC
@revisualize I need to return its value not the property itself
Zak
@zaksanderford
Jan 06 2017 02:02 UTC
@revisualize In the profile look up exercise, is the complex object an array that you apply the coordinate principal to (ie [i][j]) or should I be looking at a different way to access the other properties once I've found a firstName?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:02 UTC
took me almost that long to see it @sbxn14 ;P
Joseph
@revisualize
Jan 06 2017 02:02 UTC
@sega1219 Correct.
Sander Berntsen
@sbxn14
Jan 06 2017 02:03 UTC
@HeebieGeeBee oh thats why its bad.
Joseph
@revisualize
Jan 06 2017 02:03 UTC
@zaksanderford Let's say we have an array:
var contacts = [ "A" , "H" , "S" , "K" ];
How do you access "H"?
Sander Berntsen
@sbxn14
Jan 06 2017 02:03 UTC
alright ill lower the quality somehow.
no clue how but ill find otu how
but i I first want to get this button to work D:
Farah Soltane
@chokolate
Jan 06 2017 02:03 UTC
@johnnunns what's the logic behind: contacts[i].hasOwnProperty(prop) why you don't need to use contacts[i].hasOwnProperty===prop
Zak
@zaksanderford
Jan 06 2017 02:04 UTC
contacts[1]
agustashd
@agustashd
Jan 06 2017 02:04 UTC
@revisualize contacts[1] i think
Joseph
@revisualize
Jan 06 2017 02:04 UTC

@zaksanderford Let's say you have an object.

// var name = "Happy";
var myFriend = {
        "firstName": "Happy",
        "lastName": "Feet",
        "number": "-i",
        "likes": ["rhythm", "dancing", "soul"]
    }

How do you access the "firstName" of myFriend?

agustashd
@agustashd
Jan 06 2017 02:04 UTC
myFriend.firstName
Joseph
@revisualize
Jan 06 2017 02:05 UTC
@agustashd I am trying to help someone.
grantknaver
@grantknaver
Jan 06 2017 02:05 UTC
@JohnnyBizzel quick question...
Joseph
@revisualize
Jan 06 2017 02:05 UTC
I'll make YOU more bold next time.
Sorry about that.
Zak
@zaksanderford
Jan 06 2017 02:05 UTC
@revisualize myFriend.firstName
agustashd
@agustashd
Jan 06 2017 02:05 UTC
@JohnnyBizzel oh sorry lol
Joseph
@revisualize
Jan 06 2017 02:05 UTC

@zaksanderford Let's say we have an array:

var contacts = [ { f: "A" } , { f: "H" } , { f: "S" } , { f: "K" } ];

How do you output "H"?

grantknaver
@grantknaver
Jan 06 2017 02:05 UTC
in c = 2 ; c <= a - 1 ; c++ why do you have to take away the 1?
Fernando
@fer408
Jan 06 2017 02:06 UTC

i am having some trouble with this algorithm. I get the test cases from true but not for false.
function mutation(arr) {
var sampleA = arr.slice(0,1);
var sampleB = arr.slice(-1);
if(sampleA.indexOf(sampleA.length) == sampleB.indexOf(sampleB.length)) {
return true;
}
else
{
return false;
}

}

He Liu
@HeLiu
Jan 06 2017 02:06 UTC
how can i remove a key from an object without have to reassign it to a new object?
Zak
@zaksanderford
Jan 06 2017 02:06 UTC
@revisualize ```return contacts1
Joseph
@revisualize
Jan 06 2017 02:07 UTC
@zaksanderford Incorrect.
eeflores
@eeflores
Jan 06 2017 02:07 UTC
partial credit
Johnny
@JohnnyBizzel
Jan 06 2017 02:07 UTC
@grantknaver So you don't go over the size of the array
eeflores
@eeflores
Jan 06 2017 02:07 UTC
@zaksanderford do console.log(contacts[1]);
grantknaver
@grantknaver
Jan 06 2017 02:08 UTC
how does that prevent it
He Liu
@HeLiu
Jan 06 2017 02:08 UTC

Write a function called "removeStringValues".

Given an object, "removeStringValues" removes any properties on the given object whose values are strings.

var obj = {
name: 'Sam',
age: 20
}
removeStringValues(obj);
console.log(obj); // { age: 20 }

var obj = {
  name: 'Sam',
  age: 20
}
var newObj = {};
function removeStringValues(obj) {
  for(var key in obj){
      if(typeof obj[key] !== "string"){
          newObj= obj[key];
      }
  }
  return newObj;
} 

removeStringValues(obj);
grantknaver
@grantknaver
Jan 06 2017 02:08 UTC
wouldn't you just want to check up to the argument number
Joseph
@revisualize
Jan 06 2017 02:08 UTC
@eeflores That would still be incorrect.
Johnny
@JohnnyBizzel
Jan 06 2017 02:08 UTC
@sbxn14 Sorry, it's a bit to complicated to work out.
eeflores
@eeflores
Jan 06 2017 02:08 UTC
@revisualize but it's a hint
Sander Berntsen
@sbxn14
Jan 06 2017 02:09 UTC
@JohnnyBizzel okay.. ill just post it on stackoverflow
Yonatan Rojas
@MajorTom250993
Jan 06 2017 02:10 UTC
@Manish-Giri @Lumexralph Thank you for the advice! the code runs good :smile:
CamperBot
@camperbot
Jan 06 2017 02:10 UTC
majortom250993 sends brownie points to @manish-giri and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 662 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 3583 | @manish-giri |http://www.freecodecamp.com/manish-giri
thereal-bond
@thereal-bond
Jan 06 2017 02:12 UTC
Hey guys, looking for help with the Find the Longest Word in a String challenge
I believe I'm close, but I'm stuck.
grantknaver
@grantknaver
Jan 06 2017 02:12 UTC
and for that matter why use the modulus to rule out prime instead of the main identifier
sega1219
@sega1219
Jan 06 2017 02:12 UTC
@revisualize I'm asking how do I only access only a property's value
thereal-bond
@thereal-bond
Jan 06 2017 02:13 UTC
function findLongestWord(str) {
  var array = str.split(" ");

  array.sort(function sort (a,b)  {
    return b.length - a.length;
  });
   {
   array[0]=str;
     return str.length;
  }

}

findLongestWord("The quick brown fox jumped over the lazy dog");
grantknaver
@grantknaver
Jan 06 2017 02:13 UTC
@JohnnyBizzel sorry for 20 questions. Just trying to figure this out
Joseph
@revisualize
Jan 06 2017 02:13 UTC

Here is the question that I asked:

@sega1219 How do you access an object property?

Here is a link to how you could answer that question:
@sega1219 Accessing Objects Properties with Bracket Notation https://www.freecodecamp.com/challenges/accessing-objects-properties-with-bracket-notation

sega1219
@sega1219
Jan 06 2017 02:13 UTC
@revisualize thank you
CamperBot
@camperbot
Jan 06 2017 02:13 UTC
sega1219 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: sega1219 already gave revisualize points
Joseph
@revisualize
Jan 06 2017 02:15 UTC
@sega1219 I asked my question very specifically as to relate it back to the map and what you learned before.
Zak
@zaksanderford
Jan 06 2017 02:17 UTC
@revisualize contacts[1].f
Joseph
@revisualize
Jan 06 2017 02:17 UTC
@zaksanderford YES.
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:17 UTC
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++)
for(var k=0; k<arr[i].length; k++){
product=product*arr[i][j][k];
}
}
Joseph
@revisualize
Jan 06 2017 02:17 UTC
@zaksanderford So, going back to your question.
@zaksanderford Where is the [i][j]?
cubancigaro
@cubancigaro
Jan 06 2017 02:17 UTC
ok need help with generate random fractions with javascript
Zak
@zaksanderford
Jan 06 2017 02:18 UTC
[1][0]
Joseph
@revisualize
Jan 06 2017 02:18 UTC
@zaksanderford Hint: There isn't a j needed.
No.
There is no second array.
Look at your array of objects.
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:18 UTC
can some one help me by debugging where i have done wrong in this following code :
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++)
for(var k=0; k<arr[i].length; k++){
product=product*arr[i][j][k];
}
}
Joseph
@revisualize
Jan 06 2017 02:19 UTC
@nehamchangappa Too far. Remove the for for the k
Anyhow.
It is 620pm PST.
I am going HOME.
:v:
Zak
@zaksanderford
Jan 06 2017 02:20 UTC
thanks @revisualize
CamperBot
@camperbot
Jan 06 2017 02:20 UTC
zaksanderford sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2857 | @revisualize |http://www.freecodecamp.com/revisualize
Zak
@zaksanderford
Jan 06 2017 02:20 UTC
@revisualize travel safe
Joseph
@revisualize
Jan 06 2017 02:21 UTC
@zaksanderford Hopefully, my series of questions helped.
Carlos
@jeancarlospena
Jan 06 2017 02:21 UTC
@nehamchangappa forgot one closing }
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:21 UTC
thanks @revisualize
CamperBot
@camperbot
Jan 06 2017 02:21 UTC
nehamchangappa sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: nehamchangappa already gave revisualize points
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:21 UTC
@carloslocoo where did i forget it ?
Joseph
@revisualize
Jan 06 2017 02:22 UTC
@carloslocoo She didn't if she removes the for line for that k stuff like I said.
Carlos
@jeancarlospena
Jan 06 2017 02:22 UTC
@nehamchangappa the middle for loop does not have closing or opening braces{}
NEHA MITTOOR CHANGAPPA
@nehamchangappa
Jan 06 2017 02:23 UTC
@carloslocoo yaa got it ! thanks
CamperBot
@camperbot
Jan 06 2017 02:23 UTC
nehamchangappa sends brownie points to @carloslocoo :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @carloslocoo |http://www.freecodecamp.com/carloslocoo
Carlos
@jeancarlospena
Jan 06 2017 02:24 UTC
how do i check how many cookies i have?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:25 UTC
well it says it there
Omer Tarik Koc
@omertarik96
Jan 06 2017 02:25 UTC

Hello, I am trying to solve lookup profile challenge. I did write that code

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

  }

  if (firstName === contacts[firstName] && prop === contacts[prop]) {
    return contacts[prop];
  }



}

What am I missing?

HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:26 UTC
why are you returning contact[i}
and not using it for your if statement
not using the loop*
Omer Tarik Koc
@omertarik96
Jan 06 2017 02:27 UTC
@HeebieGeeBee Yes, u r right. I should use it
justinbarr00
@justinbarr00
Jan 06 2017 02:28 UTC
How do you comment code that looks like it is still in the console?
Randall Wyatt
@RandallWy
Jan 06 2017 02:28 UTC
Can someone help me with Java? not JS. there really isnt a room for java
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:28 UTC
''' @justinbarr00
Mike
@MikeJSchorah
Jan 06 2017 02:29 UTC
@RandallWy There is, but no one is on it. I can help if it's basic Java
justinbarr00
@justinbarr00
Jan 06 2017 02:29 UTC
@HeebieGeeBee Thanks
CamperBot
@camperbot
Jan 06 2017 02:29 UTC
justinbarr00 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 450 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:29 UTC
no wait
its backticks
'''
CamperBot
@camperbot
Jan 06 2017 02:29 UTC
:bulb: to format code use backticks! ``` more info
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:29 UTC
there it is
click that more info
@justinbarr00
justinbarr00
@justinbarr00
Jan 06 2017 02:30 UTC
I am having trouble with everything in this if statement running true.

''' function titleCase(str) {

var arr = [];
var strl = str.toLowerCase();

arr = strl.split('');

for (var i = 0 ; i < arr.length ; i++) {
if ( (arr[0]) || (arr[(i - 1)] = " ")) {
arr[i] = arr[i].toUpperCase();
}
else {
arr[i] = arr[i].toLowerCase();
}

}
return arr;
}

titleCase("I'm a little tea pot"); '''

CamperBot
@camperbot
Jan 06 2017 02:30 UTC
:bulb: to format code use backticks! ``` more info
justinbarr00
@justinbarr00
Jan 06 2017 02:30 UTC
oh wrong ones.
lol
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:30 UTC
sorry yeah read the more info thats what i was trying to bring up
Randall Wyatt
@RandallWy
Jan 06 2017 02:30 UTC
Sent you a message @MikeJSchorah
EvanK
@Trekev
Jan 06 2017 02:31 UTC
Hello all, I was wondering how to print a variable on the freeCodeCamp log so I can use it for debugging
I have tried console.log(var) but it didn't seem to print
Mike
@MikeJSchorah
Jan 06 2017 02:31 UTC
@RandallWy I don't know how to check my messages on here. I've tried it before to no avail
justinbarr00
@justinbarr00
Jan 06 2017 02:32 UTC
function titleCase(str) {


  var arr = [];
  var strl = str.toLowerCase();

  arr = strl.split('');

  for (var i = 0 ; i < arr.length ; i++) {
    if ( (arr[0]) || (arr[(i - 1)] = " ")) { 
      arr[i] = arr[i].toUpperCase();
      }
    else {
      arr[i] = arr[i].toLowerCase();
    }


  }
 return arr;
}

titleCase("I'm a little tea pot");
Randall Wyatt
@RandallWy
Jan 06 2017 02:32 UTC
@MikeJSchorah The thing I need help on is to conver a string to an int. where a=1 and A=2 || z=26 Z=52 for example.
agustashd
@agustashd
Jan 06 2017 02:32 UTC
@omertarik96 i just finished that challenge so if you need help just ask
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:32 UTC
@justinbarr00 might wanna rethink how youre doing this
grantknaver
@grantknaver
Jan 06 2017 02:32 UTC
anyone free to help me with an assignement
Mike
@MikeJSchorah
Jan 06 2017 02:33 UTC
@RandallWy I was thinking of basic basic Java. Yeah, that's on a different level for me
I thought you were going to ask me what polymorphism is or something basic like that
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:34 UTC
@justinbarr00 why would you not just split the string into an array of single words to start with?
then just go through each word and change the first letter to uppercase
justinbarr00
@justinbarr00
Jan 06 2017 02:35 UTC
@HeebieGeeBee Thanks! I was trying that originally but was having some issues with the syntax so i was trying this way. I'll see what I can find on that
CamperBot
@camperbot
Jan 06 2017 02:35 UTC
:warning: justinbarr00 already gave heebiegeebee points
justinbarr00 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
Mike
@MikeJSchorah
Jan 06 2017 02:35 UTC
@grantknaver If it's basic, shoot. If not, someone else will have to
grantknaver
@grantknaver
Jan 06 2017 02:35 UTC
here is the assignment
here is my code...
Mike
@MikeJSchorah
Jan 06 2017 02:36 UTC
Yep. It's an algorithm. @HeebieGeeBee is good with those
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:36 UTC
huh?
@MikeJSchorah
grantknaver
@grantknaver
Jan 06 2017 02:37 UTC
 var answer = [];
 for (var i = 1; i <= num; i++){
   for(var j = 1; j <=num; j++){
     if (i > 1 && i % j > 0 ){
       answer.push(i);
     }
   }
   return answer;
 }
sega1219
@sega1219
Jan 06 2017 02:37 UTC
I don't know what's wrong
Mike
@MikeJSchorah
Jan 06 2017 02:37 UTC
What's wrong @sega1219 ?
sega1219
@sega1219
Jan 06 2017 02:38 UTC

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

  // Add record here
  {"artist":"Sam Smith",
  "title":"Writings on the Wall",
  "release_year":"2015",
  "formats":[
    "CD",
    "Yotube",
    "MP3"

  ]
  }

  ];
Mike
@MikeJSchorah
Jan 06 2017 02:38 UTC
@sega1219 What's the exercise?
sega1219
@sega1219
Jan 06 2017 02:38 UTC
manipulating complex objects
Manish Giri
@Manish-Giri
Jan 06 2017 02:38 UTC
@sega1219 you need the two objects separated by a ,.
Because they are essentially two array elements.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:39 UTC
i > 1 && i % j > 0 @grantknaver is this going to find the prime number?
sega1219
@sega1219
Jan 06 2017 02:39 UTC
@Manish-Giri thank you
CamperBot
@camperbot
Jan 06 2017 02:39 UTC
sega1219 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3584 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 06 2017 02:39 UTC
@sega1219 welcome
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:40 UTC
also @grantknaver it asks yu to sum the prime numbers too
grantknaver
@grantknaver
Jan 06 2017 02:40 UTC
@HeebieGeeBee I understand the sum part, but first I have to obtain the primes
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:41 UTC
yeah
grantknaver
@grantknaver
Jan 06 2017 02:41 UTC
and ya it is supposed to find the primes
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:41 UTC
do you think it will?
grantknaver
@grantknaver
Jan 06 2017 02:42 UTC
well its not so Im guessing not
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:42 UTC
i > 1 && i % j > 0 go through this and do this with just a couple of numbers
say i is 8
then you loop through asking to push i into an array if the remainder of 8 and every number between 1 and 10 is greater than 0
grantknaver
@grantknaver
Jan 06 2017 02:44 UTC
hmm
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:44 UTC
to me something seems wrong there
grantknaver
@grantknaver
Jan 06 2017 02:46 UTC
because it is
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:47 UTC
as a hint
a prime number always has a remainder if you try and divide it by 2
grantknaver
@grantknaver
Jan 06 2017 02:48 UTC
ah that explains it
ok ok
but what about 2, which is prime
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:49 UTC
well thats an exception isnt it
grantknaver
@grantknaver
Jan 06 2017 02:49 UTC
ya
gotcha how about this than
sega1219
@sega1219
Jan 06 2017 02:53 UTC
I'm having issues on Testing objects for properties . Would I use an else if statement at all?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:53 UTC
usually @sega1219
well
an if statement at least
grantknaver
@grantknaver
Jan 06 2017 02:53 UTC
lol
im trying something one sec
Mike
@MikeJSchorah
Jan 06 2017 02:54 UTC
@sega1219 You need to use the .hasOwnProperty method
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:54 UTC
dont overcomplicate it @grantknaver
sega1219
@sega1219
Jan 06 2017 02:54 UTC
@MikeJSchorah
Mike
@MikeJSchorah
Jan 06 2017 02:54 UTC
@sega1219 Check to see if myObj has checkProp in an if statement
Diego Mayer
@Chrono79
Jan 06 2017 02:55 UTC
@sega1219 yes, you need to use an if (not else if)
grantknaver
@grantknaver
Jan 06 2017 02:55 UTC
 var answer = [2,];
 var i = 2;
 for (i = 2; i <= num - 1; i++) {
    if (num % i === 0 ){

    }else {
      answer.push(i);  
    }
 }
  return answer;
}
sega1219
@sega1219
Jan 06 2017 02:55 UTC
 var value=myObj.checkProp;
  myObj.hasOwnProperty(checkProp);
 if (true){
   return value;
 }else if (false){
  return "Not Found";}
}
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:55 UTC
@grantknaver no
grantknaver
@grantknaver
Jan 06 2017 02:55 UTC
well ok
Diego Mayer
@Chrono79
Jan 06 2017 02:56 UTC
@sega1219 that won't work (for several reasons)
Mike
@MikeJSchorah
Jan 06 2017 02:56 UTC
myObj.hasOwnProperty(checkProp);
Put this inside of your if statement
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:56 UTC
your loop wants to be iterating through all the numbers upto num
@grantknaver
sega1219
@sega1219
Jan 06 2017 02:56 UTC
thank you @MikeJSchorah
CamperBot
@camperbot
Jan 06 2017 02:56 UTC
sega1219 sends brownie points to @mikejschorah :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @mikejschorah |http://www.freecodecamp.com/mikejschorah
sega1219
@sega1219
Jan 06 2017 02:56 UTC
thank you @Chrono79
CamperBot
@camperbot
Jan 06 2017 02:56 UTC
sega1219 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3064 | @chrono79 |http://www.freecodecamp.com/chrono79
grantknaver
@grantknaver
Jan 06 2017 02:57 UTC
 var answer = [2,];
 var i = 2;
 for (i = 2; i <= num; i++) {
    if (num % i === 0 ){

    }else {
      answer.push(i);  
    }
 }
  return answer;
}
Mike
@MikeJSchorah
Jan 06 2017 02:57 UTC
@sega1219 myObj should be the variable too, not value
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:58 UTC
why num % i?
Diego Mayer
@Chrono79
Jan 06 2017 02:58 UTC
@sega1219
 if (true){ //true is always true (no surprise there)
   return value;
 }else if (false){ // this if is never reached and false is never true, so even if the first condition wasn't true, it'll never enter this if
  return "Not Found";}
}
grantknaver
@grantknaver
Jan 06 2017 02:58 UTC
if num % i equals zero than it is not an prime because prime has a remainder
with the exception of 2 which is already in the array
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 02:59 UTC
hmmm
grantknaver
@grantknaver
Jan 06 2017 03:00 UTC
idk man I am competely confused
this tough been on it forever
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:01 UTC
why not if (i%2 != 0) answer.push[i]
Dylan Hsiao
@greedylan
Jan 06 2017 03:01 UTC
could anyone kindly explain the concept of Boolean Object....been reading the documentation but still can't wrap my head around it
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:01 UTC
maybe your way would work i just have to get my head around thinking that way
lol
Mike
@MikeJSchorah
Jan 06 2017 03:02 UTC
@greedylan You're basically just testing whether something is true or false. What would you like to know about it?
grantknaver
@grantknaver
Jan 06 2017 03:02 UTC
its not and yours is shorter
me try
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:03 UTC
i may not have done all the syntax properly there make sure you write the if statement properly
lol
grantknaver
@grantknaver
Jan 06 2017 03:04 UTC
that i can do lol
Dylan Hsiao
@greedylan
Jan 06 2017 03:04 UTC
@MikeJSchorah If the value is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), new Boolean(value) returns false?
grantknaver
@grantknaver
Jan 06 2017 03:04 UTC
your basically doing the opposite of what I was doing
sega1219
@sega1219
Jan 06 2017 03:05 UTC
if (myObj.hasOwnProperty(checkProp)){
   return myObj;
 }else
  return "Not Found";
}
Mike
@MikeJSchorah
Jan 06 2017 03:06 UTC
@greedylan It's just something that you have to accept. That is just what happens because when there is nothing there, it will return false. It's only true if it is in fact true. All other else, it is false.
grantknaver
@grantknaver
Jan 06 2017 03:06 UTC
what about 10
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:06 UTC
what about 10?
10 isnt a prime number
Manish Giri
@Manish-Giri
Jan 06 2017 03:07 UTC
@sega1219 when the property exists, you need to return it's value, not the object itself
grantknaver
@grantknaver
Jan 06 2017 03:07 UTC
sorry that is not what I meant
Mike
@MikeJSchorah
Jan 06 2017 03:07 UTC
@sega1219 It's looking good. You're almost there. Just remember that you're returning the property that you're checking in the array of myObj in an array format since myObj is an array.
grantknaver
@grantknaver
Jan 06 2017 03:08 UTC
it populated 9 and that isnt a prime
Manish Giri
@Manish-Giri
Jan 06 2017 03:08 UTC
I thought myObj was an object..
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:08 UTC
how?
9%2 = 1
grantknaver
@grantknaver
Jan 06 2017 03:09 UTC
shrug yep
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:09 UTC
put the code up
grantknaver
@grantknaver
Jan 06 2017 03:09 UTC
will do
lol
Mike
@MikeJSchorah
Jan 06 2017 03:09 UTC
return myObj[checkProp];
@sega1219 I know what I just said probably sounds confusing, so here is what that line should look like
grantknaver
@grantknaver
Jan 06 2017 03:09 UTC
 var answer = [2,];
 var i = 2;
 for (i = 2; i < num; i++) {
    if (i%2 !== 0){
      answer.push(i);  
    }
 }
  return answer;
sega1219
@sega1219
Jan 06 2017 03:10 UTC
@MikeJSchorah oh ok thank youso much
CamperBot
@camperbot
Jan 06 2017 03:10 UTC
sega1219 sends brownie points to @mikejschorah :sparkles: :thumbsup: :sparkles:
:warning: sega1219 already gave mikejschorah points
sega1219
@sega1219
Jan 06 2017 03:10 UTC
@Manish-Giri thank you too
CamperBot
@camperbot
Jan 06 2017 03:10 UTC
sega1219 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: sega1219 already gave manish-giri points
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:11 UTC
what does this "+=" do again?
Manish Giri
@Manish-Giri
Jan 06 2017 03:11 UTC
@sega1219 welcome
@cesarecaravaggio depends on the context, mostly it adds the value and puts it back in the variable
Mike
@MikeJSchorah
Jan 06 2017 03:12 UTC
@cesarecaravaggio It adds something to the variable on the left
Manish Giri
@Manish-Giri
Jan 06 2017 03:12 UTC
so x += 5 is the same as x = x + 5
grantknaver
@grantknaver
Jan 06 2017 03:15 UTC
its weird isn't it
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:16 UTC

thanks guys @Manish-Giri @MikeJSchorah @Chrono79 i actually wanted to know its use here

function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}

i'd take a 1-sentence explanation on what is going on in that code.

CamperBot
@camperbot
Jan 06 2017 03:16 UTC
cesarecaravaggio sends brownie points to @manish-giri and @mikejschorah and @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @mikejschorah |http://www.freecodecamp.com/mikejschorah
:star2: 3065 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 3585 | @manish-giri |http://www.freecodecamp.com/manish-giri
Diego Mayer
@Chrono79
Jan 06 2017 03:18 UTC
@cesarecaravaggio basically what @Manish-Giri and @MikeJSchorah told youm, in this case is string concatenation
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output = "myGlobal: " + myGlobal; //this here could use  = instead
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal; //this one not, because output here could have already content 
  }
  console.log(output);
}
grantknaver
@grantknaver
Jan 06 2017 03:18 UTC
@HeebieGeeBee u still there
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:18 UTC
ok i guess i was wrong @grantknaver
i dont get why it pushed 9
grantknaver
@grantknaver
Jan 06 2017 03:19 UTC
how? your logic seemed right?
weird......
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:19 UTC
i just went and checked back how i didn mine
Creg Antony
@cregantony
Jan 06 2017 03:19 UTC
Ok I'm stumped what is wrong with this?
var myStr= "FirstLine \n \SecondLine\ \r Thirdline" ; // Change this line
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:19 UTC
i dont know why it pushed 9 but it will miss out some prime numbers when you get further
grantknaver
@grantknaver
Jan 06 2017 03:20 UTC
well than dang
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:20 UTC
im baffled about that
grantknaver
@grantknaver
Jan 06 2017 03:20 UTC
ok lol. Well at least I am not the only one
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:21 UTC
but yeah you'll have to create two loops like you did before
sorry
Diego Mayer
@Chrono79
Jan 06 2017 03:21 UTC
@cregantony several things
it's ThirdLine
delete all spaces
escape the backslashes around SecondLine
grantknaver
@grantknaver
Jan 06 2017 03:21 UTC
ug dang
that made sense, but it wont work
my logic was
you take i and check it against all of j
than you do that with all of i until you are up to the argument number
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:23 UTC
it was such a long time ago im guessing i must have tried what i just tried with you the first time and figured it didnt work
grantknaver
@grantknaver
Jan 06 2017 03:24 UTC
OK
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:24 UTC
yeah that sounds good
grantknaver
@grantknaver
Jan 06 2017 03:25 UTC
ill try again
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:25 UTC
then if it doesnt divide perfectly with j before i equalling j
grantknaver
@grantknaver
Jan 06 2017 03:26 UTC
that is what I am thinking
here I go lets see
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:26 UTC
cool
Nathan
@Renown0
Jan 06 2017 03:26 UTC
Hey, when someone's not busy, mind helping me clarify something for a challenge?
Joseph
@revisualize
Jan 06 2017 03:27 UTC
WRAW!
@Renown0 Which?
Mike
@MikeJSchorah
Jan 06 2017 03:27 UTC
Sounds like an angry revisualize, like always LOL
Nathan
@Renown0
Jan 06 2017 03:27 UTC
"Record Collection"
A little bit. XD
Joseph
@revisualize
Jan 06 2017 03:28 UTC
@Renown0 Whatcha got?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:28 UTC
he musta just eaten or summin
Nathan
@Renown0
Jan 06 2017 03:28 UTC
So, this is what it gives us to start:
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
     },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function updateRecords(id, prop, value) {
  return collection;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:28 UTC
and hes full of energy again
Mike
@MikeJSchorah
Jan 06 2017 03:28 UTC
A bunch of chit?
Joseph
@revisualize
Jan 06 2017 03:28 UTC
@Renown0 Okay.
They must have changed it.
Nathan
@Renown0
Jan 06 2017 03:29 UTC
I'm guessing that to begin with I need to add a few var bits in the given function?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:29 UTC
you not tried anything @Renown0 ?
Joseph
@revisualize
Jan 06 2017 03:29 UTC
@Renown0 Nope.
Nathan
@Renown0
Jan 06 2017 03:29 UTC
Not yet. Just clarifying what I need to do before I jump in.
Or, rather what I should NOT do apparently. Lol.
Joseph
@revisualize
Jan 06 2017 03:29 UTC
@Renown0 You have three variables parameters. Already.
@Renown0 This is where you say: @revisualize What are parameters?
Mike
@MikeJSchorah
Jan 06 2017 03:30 UTC
Where is Record Collection? I don't even see it
Joseph
@revisualize
Jan 06 2017 03:30 UTC
@MikeJSchorah Advanced Algo.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:30 UTC
yeah why did they move it
Mike
@MikeJSchorah
Jan 06 2017 03:31 UTC
Oh. Nevermind. I was going to say I didn't do it yet, but it looks like I did do it and they moved it in the last 6 months
Nathan
@Renown0
Jan 06 2017 03:31 UTC
Lol. Well the parameters I believe are in updateRecords(id, prop, value) right?
Joseph
@revisualize
Jan 06 2017 03:31 UTC
@HeebieGeeBee Eye Dee Kay
@Renown0 Yes.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:31 UTC
when i saw that pop up again after getting to the advanced algorithms
Joseph
@revisualize
Jan 06 2017 03:31 UTC
@Renown0 How do you use parameters in your function?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:31 UTC
i was like what the fuck the pushed me back or summin
Mike
@MikeJSchorah
Jan 06 2017 03:31 UTC
@HeebieGeeBee Apparently it was difficult
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:31 UTC
but it is exactly the same
Joseph
@revisualize
Jan 06 2017 03:31 UTC
@Renown0 just like variables
Mike
@MikeJSchorah
Jan 06 2017 03:32 UTC
They're all difficult... time to go get drunk
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:32 UTC
nowhere near as difficult as the other advanced challenges
Mike
@MikeJSchorah
Jan 06 2017 03:32 UTC
Yeah. I didn't think it stuck out either.
Joseph
@revisualize
Jan 06 2017 03:32 UTC
Yeah, It looks like the same challenge.
grantknaver
@grantknaver
Jan 06 2017 03:32 UTC
I think I see the issue now
Mike
@MikeJSchorah
Jan 06 2017 03:32 UTC
Although I haven't seen it in 6 months
Nathan
@Renown0
Jan 06 2017 03:33 UTC
@revisualize Asking me the tough questions now. Lol. I'm probably going to need to go back a little and review what I've learned because something isn't adding up quite right to me.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:33 UTC
what @grantknaver
Joseph
@revisualize
Jan 06 2017 03:33 UTC
grantknaver
@grantknaver
Jan 06 2017 03:34 UTC
I need a way to isolate only those that solely have only % = 0
Nathan
@Renown0
Jan 06 2017 03:34 UTC
Oh shoot. Looks like you've had this question before huh? @revisualize
Or you just keep really good notes.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:34 UTC
post what code you have @grantknaver
you probably just have to break the loop
grantknaver
@grantknaver
Jan 06 2017 03:35 UTC
function getSum(total, num) {
    return total + num;
}
 var answer = [2,];
  for (var i = 2; i <= num; i++){
   for(var j = 2; j <=num; j++){
     if (i % j === 0 ){
       answer.push(i);
     }
   }
 }
Joseph
@revisualize
Jan 06 2017 03:35 UTC
@Renown0 People come in here ALL time time (before they moved the challenge.
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:35 UTC
ok @Chrono79 got it
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:35 UTC
not if i & j === 0 push it
grantknaver
@grantknaver
Jan 06 2017 03:36 UTC
sorry I left that there
Nathan
@Renown0
Jan 06 2017 03:36 UTC
Ah, makes sense. Was it in a different place before? Because I'm still relatively early on to all this JS stuff.
Joseph
@revisualize
Jan 06 2017 03:36 UTC
@Renown0 It's now in the Advanced Algos
@Renown0 You can solve it if you just read.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:37 UTC
i == j you push it but if it gets to i%j === 0 you want to break the loop
grantknaver
@grantknaver
Jan 06 2017 03:38 UTC
why doesnt i %j === 0 mean it is possibly prime
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:39 UTC
becuase it will have been divided equally by a nmber that wasnt itself
grantknaver
@grantknaver
Jan 06 2017 03:40 UTC
but j goes up by the same number so technically when i is 5 j is 5
Nathan
@Renown0
Jan 06 2017 03:40 UTC
Yup! Working on that now. Thanks @revisualize ! You write good stuff here.
CamperBot
@camperbot
Jan 06 2017 03:40 UTC
renown0 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2858 | @revisualize |http://www.freecodecamp.com/revisualize
grantknaver
@grantknaver
Jan 06 2017 03:40 UTC
wait nvm
wow
nvm
stupid comment
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:40 UTC
yeah when i and j reach equal its prime
sorry
Kurt
@recnepstruk
Jan 06 2017 03:41 UTC
anyone good with angular?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:42 UTC
how long has angular been out?
that wasnt to say someone here wouldnt be good at it, i was just wondering
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:43 UTC
// Declare your variable here
var myGlobal = "global";

function fun1() {
  // Assign 5 to oopsGlobal Here
  oopsGlobal = 5;
}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
How do i assign the number 10 to myGlobal??
Ademola Adegbuyi
@ooade
Jan 06 2017 03:43 UTC
@HeebieGeeBee About a year ago
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:43 UTC
ahh ok cool ty @ooade
CamperBot
@camperbot
Jan 06 2017 03:43 UTC
heebiegeebee sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 791 | @ooade |http://www.freecodecamp.com/ooade
Joseph
@revisualize
Jan 06 2017 03:44 UTC
OMG!
This is my kind of a website.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:44 UTC
that looks complicated @cesarecaravaggio
Joseph
@revisualize
Jan 06 2017 03:44 UTC
AHHHH HA HA HA HA!
mitron6
@mitron6
Jan 06 2017 03:44 UTC
@cesarecaravaggio myGlobal = 10
Ademola Adegbuyi
@ooade
Jan 06 2017 03:44 UTC
@revisualize LOL
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:45 UTC
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
whats your thinking behind this?
@cesarecaravaggio
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:45 UTC
@HeebieGeeBee that'sactually part of the question haha i dint write that.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:46 UTC
oh ok
ok cool then that makes more sense
babajide odusola
@cesarecaravaggio
Jan 06 2017 03:46 UTC
yeah im only doing the part before fun2(
Joseph
@revisualize
Jan 06 2017 03:46 UTC
DAMN! I wish I would have made this website!
grantknaver
@grantknaver
Jan 06 2017 03:46 UTC
@HeebieGeeBee thanks for the help man
CamperBot
@camperbot
Jan 06 2017 03:46 UTC
grantknaver sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 451 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
emr53f
@emr53f
Jan 06 2017 03:47 UTC
i'm confused about using reduce to condense arrays. The example code they give is var singleVal = array.reduce(function(previousVal, currentVal) { return previousVal - currentVal; }, 0);
Ademola Adegbuyi
@ooade
Jan 06 2017 03:47 UTC
That would be nice tho :sweat_smile:
emr53f
@emr53f
Jan 06 2017 03:47 UTC
what is the 0 for?
grantknaver
@grantknaver
Jan 06 2017 03:47 UTC
that was a weird way to test but it worked.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:47 UTC
lol not sure how much i was, but hey sometimes realising what we shouldnt do is a good start huh
emr53f
@emr53f
Jan 06 2017 03:47 UTC
the explainer doesnt give a reason for the 0, but the function doesnt work without it
mitron6
@mitron6
Jan 06 2017 03:48 UTC
@emr53f The zero is the initial value for previousVal.
emr53f
@emr53f
Jan 06 2017 03:49 UTC
OHHHHHHHHH
thank you @mitron6 !!
CamperBot
@camperbot
Jan 06 2017 03:49 UTC
emr53f sends brownie points to @mitron6 :sparkles: :thumbsup: :sparkles:
:cookie: 432 | @mitron6 |http://www.freecodecamp.com/mitron6
grantknaver
@grantknaver
Jan 06 2017 03:49 UTC
lol I knew the double loop was right, but I have to admit I checking to see if i==j and than excluding it as a prime by seeing if j % i == 0 was interesting
Ademola Adegbuyi
@ooade
Jan 06 2017 03:49 UTC

@revisualize The best part i like is the quote :smile:

"Good design is as little design as possible."

  • some German motherfucker
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:50 UTC
im still wondering how js thinks 9%2 doesnt = 0
Joseph
@revisualize
Jan 06 2017 03:50 UTC
hehehe
@HeebieGeeBee Because it doesn't.
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:50 UTC
i mean does
Joseph
@revisualize
Jan 06 2017 03:51 UTC
What!
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:51 UTC
or do i
grantknaver
@grantknaver
Jan 06 2017 03:51 UTC
what you talking. stop using logic damnit
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:51 UTC
fecking confusing myself now
grantknaver
@grantknaver
Jan 06 2017 03:51 UTC
lol
Joseph
@revisualize
Jan 06 2017 03:51 UTC
9%2 is 1
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:51 UTC
yeah its 1
grantknaver
@grantknaver
Jan 06 2017 03:51 UTC
@revisualize no it isnt
Joseph
@revisualize
Jan 06 2017 03:51 UTC
YES IT IS!
grantknaver
@grantknaver
Jan 06 2017 03:51 UTC
javascript says it is lol
Joseph
@revisualize
Jan 06 2017 03:51 UTC

9%2 is 1!

grantknaver
@grantknaver
Jan 06 2017 03:52 UTC
@revisualize lol @HeebieGeeBee that was fun
Joseph
@revisualize
Jan 06 2017 03:52 UTC
WRAR!
I'm going to watch some youtube.
LOL!
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:52 UTC
so why does if (i%2!== 0){ answer.push(i);
does it push 9 when i is 9
Joseph
@revisualize
Jan 06 2017 03:53 UTC
Show me more.
Ademola Adegbuyi
@ooade
Jan 06 2017 03:53 UTC
Maths says, or some dudes who gave to us that way :smirk:
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:53 UTC
ffs
RomingArt
@RomingArt
Jan 06 2017 03:54 UTC
Hello I am having trouble with Word Blanks section can someone help please.
Joseph
@revisualize
Jan 06 2017 03:55 UTC
[5,6,9,5,33,1,651,2,5,8,978,978,6574,321,9,9,9,9,9,9,9,9,4654,3,7].filter( x => x%2 === 0);
[ 6, 2, 8, 978, 978, 6574, 4654 ]
RomingArt
@RomingArt
Jan 06 2017 03:55 UTC
Thank you @revisualize
CamperBot
@camperbot
Jan 06 2017 03:55 UTC
romingart sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2859 | @revisualize |http://www.freecodecamp.com/revisualize
Ademola Adegbuyi
@ooade
Jan 06 2017 03:56 UTC
@HeebieGeeBee Based on @revisualize snippet; They'll have one thing in common i.e They are divisible by 2 x % 2 === 0
Joseph
@revisualize
Jan 06 2017 03:57 UTC
Remainder:
http://images.tutorvista.com/cms/images/38/remainder1.PNG
13 % 2 is 1 ... 26 % 5 is 1 ... 24 % 6 is 0
24 % 5 is 4 ... 219 % 20 is 19 ... Does that help?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:57 UTC
i know that 9%2 is 1
ffs
i dont have any problems with knowing what a remainder is
Joseph
@revisualize
Jan 06 2017 03:59 UTC
I guess I don't see the whole problem.
YOUTUBE!
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 03:59 UTC
i trying to figure out where my lgic in the code fecked up
but then its 5am so maybe i should not trying to figure out such things and just realise i did something wrong and not to o it again
Mike
@MikeJSchorah
Jan 06 2017 04:01 UTC
5am?
It's 11am here
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:02 UTC
ooh so that asia?
or russia?
Mike
@MikeJSchorah
Jan 06 2017 04:02 UTC
LOL
Yeah. I'm either a Chinese diplomat or a Russian mafia member
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:02 UTC
no other options
Ademola Adegbuyi
@ooade
Jan 06 2017 04:02 UTC
@HeebieGeeBee Wow 5am here too in Africa :sweat_smile:
@HeebieGeeBee Can i take a peak at your code tho?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:03 UTC
what code?
Mike
@MikeJSchorah
Jan 06 2017 04:03 UTC
Well, I'm going to guess that you're in England @HeebieGeeBee
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:03 UTC
not quite
Ademola Adegbuyi
@ooade
Jan 06 2017 04:03 UTC
@MikeJSchorah Nigeria
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:03 UTC
im in france
Mike
@MikeJSchorah
Jan 06 2017 04:03 UTC
@HeebieGeeBee Ok same area
I was close
But, with me, you're not even close
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:03 UTC
yeah
so are you in one of the stans?
Mike
@MikeJSchorah
Jan 06 2017 04:04 UTC
I'm out in the Pacific Ocean
On a desert island typing away
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:04 UTC
thats only 6 hours aheadS?
Mike
@MikeJSchorah
Jan 06 2017 04:04 UTC
Lol. No, I'm in America
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:05 UTC
arent you meant to be gehind?
behind
Mike
@MikeJSchorah
Jan 06 2017 04:05 UTC
Yeah. 11am is behind
Oops. I meant 11pm
Lol
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:05 UTC
grrr
sega1219
@sega1219
Jan 06 2017 04:05 UTC
what is wrong with my code?

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){
      console.log(arr[i][j]);
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1],[2],[3]]);
Mike
@MikeJSchorah
Jan 06 2017 04:05 UTC
I'm so tired
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:06 UTC
lol
Mike
@MikeJSchorah
Jan 06 2017 04:06 UTC
Maybe I should code less
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:06 UTC
what are your loops doing? @sega1219
sega1219
@sega1219
Jan 06 2017 04:07 UTC
oh wait I just saw what I was doing wrong
Q_zheng
@zhengbusinesscontact
Jan 06 2017 04:08 UTC
guys, how to remove all non-alphanumeric characters in Js
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:08 UTC
j*=product not sure if you wanna do this either @sega1219
Q_zheng
@zhengbusinesscontact
Jan 06 2017 04:08 UTC
str.replace(/[^a-zA-Z0-9-]/g, '');
is not working
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:08 UTC
it should be
is the final - meant to be there?
Q_zheng
@zhengbusinesscontact
Jan 06 2017 04:09 UTC
@sega1219 product =product*arr[i][j];
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:11 UTC
str.replace(/[^a-zA-Z0-9]/g, ''); try that @zhengbusinesscontact
babajide odusola
@cesarecaravaggio
Jan 06 2017 04:18 UTC
whats the difference between |return and console.log|
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:18 UTC
console.log just logs something to console to help with debugging and stuff
babajide odusola
@cesarecaravaggio
Jan 06 2017 04:20 UTC
and how does it differ from return?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:20 UTC
it doesnt really have any effect on the function
return is part of the function
babajide odusola
@cesarecaravaggio
Jan 06 2017 04:21 UTC
oh
DevRice
@DevRice
Jan 06 2017 04:21 UTC
function chunkArrayInGroups(arr, size) {
  // Break it up.
  return arr.reduce(function(r, v, i) {
    if (i % size === 0) r.push(arr.slice(i, i + size));
    return r;
  }, []);
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2);
Can someone please explain this code to me please?
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:23 UTC
explain it how?
CamperBot
@camperbot
Jan 06 2017 04:23 UTC
no wiki entry for: it how
DevRice
@DevRice
Jan 06 2017 04:23 UTC
Like what does arr.reduce do again?
and why does the function have three variables (r, v, i)
Dylan Hsiao
@greedylan
Jan 06 2017 04:24 UTC

in "Sort Union" challenge, what is this arr variable?? Its not an object nor a string.

var arr = [1, 3, 2], [5, 2, 1, 4], [2, 1]??? is this thing legal?
do I add more argument like function uniteUnique(arr, arr2, arr3){}?

function uniteUnique(arr) {
  return arr;
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:24 UTC
it reduces the elements in an array
Ademola Adegbuyi
@ooade
Jan 06 2017 04:27 UTC
@greedylan arr would be [1, 3, 2]. You have to make use of the Arguments Object to grab the rest
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:28 UTC
This message was deleted
oops
Dylan Hsiao
@greedylan
Jan 06 2017 04:28 UTC
@ooade ty
CamperBot
@camperbot
Jan 06 2017 04:28 UTC
greedylan sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 792 | @ooade |http://www.freecodecamp.com/ooade
HeebieGeeBee
@HeebieGeeBee
Jan 06 2017 04:29 UTC
maybe i should sleep im seeing things
Ademola Adegbuyi
@ooade
Jan 06 2017 04:30 UTC
@HeebieGeeBee :+1:
Josh
@PageJimmy
Jan 06 2017 04:35 UTC
can i get some help plz
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
i think im changing the code incorrectly
fahrenheit=0;
fahrenheit=-22;

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit=0;
fahrenheit=-22;

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

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

Ademola Adegbuyi
@ooade
Jan 06 2017 04:38 UTC
@PageJimmy Do yo u know the formula used in converting from Celsius to Fahrenheit?
yaoshengli
@yaoshengli
Jan 06 2017 04:39 UTC
万能的神啊,谁知道匹配标点和空格的正则表达式
我需要帮助
Josh
@PageJimmy
Jan 06 2017 04:40 UTC
ya 9/5+32
yaoshengli
@yaoshengli
Jan 06 2017 04:41 UTC
可以写的完整点吗,我不太明白正则
Josh
@PageJimmy
Jan 06 2017 04:41 UTC
(c*9/5)+32
yaoshengli
@yaoshengli
Jan 06 2017 04:41 UTC
我试试
Ademola Adegbuyi
@ooade
Jan 06 2017 04:42 UTC
@PageJimmy You need to apply it i.e replace c with celcius and return the result
Sam Griffen
@ssgriffen
Jan 06 2017 04:42 UTC
Looking for critques on the JS and functionality of this so far, not the style (which I havent worked too much on)...appreciate any feedback I can get, thanks: http://codepen.io/ssgriffen/pen/VmOKEp
yaoshengli
@yaoshengli
Jan 06 2017 04:43 UTC
难道那个不是帮助我的正则吗?尴尬
Ademola Adegbuyi
@ooade
Jan 06 2017 04:45 UTC
@yaoshengli 去你的房间 ~ Google translate :sweat_smile:
yaoshengli
@yaoshengli
Jan 06 2017 04:46 UTC
ok,I need find the Google translate first……
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:46 UTC
Hello everyone, i need some help on the Wikipedia viewer, i am unable to retrieve JSON data from the wikipedia api
Can someone help?
'''
CamperBot
@camperbot
Jan 06 2017 04:47 UTC
:bulb: to format code use backticks! ``` more info
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:47 UTC
$(document).ready(function(){
  $("#button").click(function(){
    var url = "https://en.wikipedia.org/w/api.php?action=query&format=jsonp&prop=info&titles=Albert+Einstein";
    var x = document.getElementById("para");
   $.get(url,{},function(data){
      x.innerHTML(data);
    }); 
//     $.ajax( {
//     url: url,
//     data: 'hi',
//     dataType: 'json',
//     type: 'GET',
//     headers: { 'Api-User-Agent': 'karanvir95@gmail.com' },
//     success: function(data) {
//        // do something with data
//       x.innerHTML(data);
//     }
// } );
  });
});
Josh
@PageJimmy
Jan 06 2017 04:47 UTC
@ooade not sure how to set up the formula
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:47 UTC
This is what my JS looks like
Josh
@PageJimmy
Jan 06 2017 04:47 UTC

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

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

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

Karanvir Singh
@KarnageKnight
Jan 06 2017 04:48 UTC
?
Can anyone help
Somia ♡
@somiajagadish
Jan 06 2017 04:48 UTC

// Setup
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
for (var i = 0; i < myArr.length; i++ ) {
console.log(myArr[i]);
}

Help??
:blue_heart: :cloud: :sparkles:
Ademola Adegbuyi
@ooade
Jan 06 2017 04:49 UTC
@PageJimmy replace ConvertToF*9/5+32 with farenheit = (c*9/5)+32
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:49 UTC
@somiajagadish what are you trying to output?
Somia ♡
@somiajagadish
Jan 06 2017 04:49 UTC
@KarnageKnight Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total.
Charity
@charityyoungblood
Jan 06 2017 04:49 UTC
Hello everyone. I've been at this for the past hour and cannot figure out what's wrong! :(
Any help would be appreciated
Here's my code
Ademola Adegbuyi
@ooade
Jan 06 2017 04:50 UTC

@somiajagadish

Declare and initialize a variable total to 0

Charity
@charityyoungblood
Jan 06 2017 04:50 UTC

//Changed string to lower case - no case sensitive issues
function palindrome(str) {
// Good luck

str=str.toLowerCase();
//Loop to replace special characters without using regular expression
for (var i = 0; i < str.length; i++) {
str=str.replace(/[ ( ) , . " " _ - ]/, "");

}
var anotherString = str.split("").reverse().join("");
if(str==anotherString) {
return true;
}
return false;
}

palindrome("eye");

Karanvir Singh
@KarnageKnight
Jan 06 2017 04:50 UTC
so u need to add all ur elements from the myArr? @somiajagadish
Charity
@charityyoungblood
Jan 06 2017 04:50 UTC
This is for the "Check for palindromes"
Somia ♡
@somiajagadish
Jan 06 2017 04:50 UTC
@ooade Didn't I do that?
Ademola Adegbuyi
@ooade
Jan 06 2017 04:51 UTC
@somiajagadish No, you didn't :sweat_smile:
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:51 UTC
@somiajagadish you did not declare any variable
Somia ♡
@somiajagadish
Jan 06 2017 04:51 UTC
@KarnageKnight Where should I declare it? Because it said to only change code below that comment? :laughing:
Kevon Cambridge
@KevonTooPro
Jan 06 2017 04:51 UTC
So I am doing this challenge for java and I need to find all the multiples of 3 or 5 ranging to 1000
could someone help me?
Charity
@charityyoungblood
Jan 06 2017 04:51 UTC
It works for all except palindrome("0_0 (: /-\ :) 0-0")
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:52 UTC
// Setup
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
var sum=0;
for (var i = 0; i < myArr.length; i++ ) {

  console.log(myArr[i]);
}
Then change it below the comment, doesnt make a difference does it? @somiajagadish
Josh
@PageJimmy
Jan 06 2017 04:52 UTC
@ooade made sense that way fahrenheit=(c*9/5)+32; but c is not defined
Ademola Adegbuyi
@ooade
Jan 06 2017 04:52 UTC
@KarnageKnight They said total...
Somia ♡
@somiajagadish
Jan 06 2017 04:52 UTC
@KarnageKnight Ohh okay thanks
CamperBot
@camperbot
Jan 06 2017 04:52 UTC
somiajagadish sends brownie points to @karnageknight :sparkles: :thumbsup: :sparkles:
:cookie: 267 | @karnageknight |http://www.freecodecamp.com/karnageknight
Somia ♡
@somiajagadish
Jan 06 2017 04:53 UTC
@ooade and thanks to :)
CamperBot
@camperbot
Jan 06 2017 04:53 UTC
somiajagadish sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 793 | @ooade |http://www.freecodecamp.com/ooade
Ademola Adegbuyi
@ooade
Jan 06 2017 04:53 UTC
@PageJimmy replace c with celcius
@somiajagadish YWC :wink: You're still coming back tho :sweat_smile:
Josh
@PageJimmy
Jan 06 2017 04:53 UTC
the boy wonder
thanks @ooade
CamperBot
@camperbot
Jan 06 2017 04:53 UTC
pagejimmy sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 794 | @ooade |http://www.freecodecamp.com/ooade
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:53 UTC
@ooade yeah i'll let the challenge be a challenge and let her work it out :)
@ooade if she still needs help, she'll ask her, the sum will be the var we add
Somia ♡
@somiajagadish
Jan 06 2017 04:54 UTC
@ooade haha ur right
Ademola Adegbuyi
@ooade
Jan 06 2017 04:54 UTC
@KarnageKnight That's cool :smile:
Somia ♡
@somiajagadish
Jan 06 2017 04:54 UTC
Im back lol
var total = 0;
for (var i = 0; i < myArr.length; i++ ) {
console.log(myArr[i]);
}
Ademola Adegbuyi
@ooade
Jan 06 2017 04:54 UTC
@somiajagadish That was fast :smile:
Somia ♡
@somiajagadish
Jan 06 2017 04:54 UTC
i added the variable
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:54 UTC
XDD
no you did not @somiajagadish
Somia ♡
@somiajagadish
Jan 06 2017 04:54 UTC
but its saying it should equal 20
@ooade IKR LOL
@KarnageKnight the var total
Ademola Adegbuyi
@ooade
Jan 06 2017 04:55 UTC
@somiajagadish Yeah, as your loop runs, you should set total to a new value i.e keep adding up myArray[i] to total
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:56 UTC
var total = 0;
for (var i = 0; i < myArr.length; i++ ) {
total+=myArr[i
}
console.log(myArr[i]);
thats more like it @somiajagadish
@somiajagadish you need to add every element into the ''total'' variable until the array runs out
Somia ♡
@somiajagadish
Jan 06 2017 04:57 UTC
@KarnageKnight ohh THANKS
CamperBot
@camperbot
Jan 06 2017 04:57 UTC
somiajagadish sends brownie points to @karnageknight :sparkles: :thumbsup: :sparkles:
:warning: somiajagadish already gave karnageknight points
Somia ♡
@somiajagadish
Jan 06 2017 04:57 UTC
@ooade Thanks!
CamperBot
@camperbot
Jan 06 2017 04:57 UTC
somiajagadish sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:warning: somiajagadish already gave ooade points
Ademola Adegbuyi
@ooade
Jan 06 2017 04:57 UTC
@somiajagadish :+1:
Somia ♡
@somiajagadish
Jan 06 2017 04:58 UTC
@ooade :thumbsup:
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:58 UTC
@ooade bro have you completed the intermediate front end projects?
Ademola Adegbuyi
@ooade
Jan 06 2017 04:58 UTC
@KarnageKnight Yeah :sweat_smile:
Karanvir Singh
@KarnageKnight
Jan 06 2017 04:59 UTC
@ooade could you help me out a little on my wikipedia viewer? i can't seem to get a JSON reply
@ooade

@ooade XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&format=jsonp&prop=info&titles=Albert+Einstein. Origin null is not allowed by Access-Control-Allow-Origin.
Selected Element

<html>…</html>

this is the error i get in inspect element of my browser
Ademola Adegbuyi
@ooade
Jan 06 2017 05:01 UTC
@KarnageKnight Okay. format should be json
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:01 UTC
same with json @ooade
Ademola Adegbuyi
@ooade
Jan 06 2017 05:02 UTC
@KarnageKnight Not quite true on wiki end. jsonp isn't a valid format over there
Your Ajax dataType would be the one to take jsonp as a value
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:03 UTC
@ooade i tried it with json as well would you like to see the JS?
@ooade ```
@ooade
```
$(document).ready(function(){
  $("#button").click(function(){
    var url = "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&titles=Albert+Einstein";
    var x = document.getElementById("para");
   $.get(url,{},function(data){
      x.innerHTML(data);
    });
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:08 UTC
@ooade same thing i dont see the problem anymore
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:10 UTC
@ooade nope. the exact same thing
timb
@timb206
Jan 06 2017 05:11 UTC

`
var myVar = 87;

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

`

will someone tell me how to do this one
Ademola Adegbuyi
@ooade
Jan 06 2017 05:11 UTC
@KarnageKnight Any log errors?
timb
@timb206
Jan 06 2017 05:11 UTC
im not grasping it for some reason
Ademola Adegbuyi
@ooade
Jan 06 2017 05:11 UTC
@timb206 what are you trying to achieve?
timb
@timb206
Jan 06 2017 05:11 UTC
i did myVar = myVar++1;
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:11 UTC
@ooade XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&format=jsonp&prop=info&titles=Albert+Einstein. Origin null is not allowed by Access-Control-Allow-Origin.
Selected Element
timb
@timb206
Jan 06 2017 05:11 UTC
add one using the ++ operand
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:12 UTC
just use myVar++; @timb206
Ademola Adegbuyi
@ooade
Jan 06 2017 05:12 UTC
@KarnageKnight Oops! Cors issue :sweat_smile:
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:12 UTC
@ooade whats that?
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:13 UTC
@timb206 did you know why myVar = myVar++1 didn't work?
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:13 UTC
@ooade how do i work around it?
timb
@timb206
Jan 06 2017 05:13 UTC
nope
DevRice
@DevRice
Jan 06 2017 05:13 UTC
function mutation(arr) {
  var pos = [];
  for(var x = 0; x < arr.length; x++){
    for(var y = 0; y < arr[x].length; y++){
      pos.push(arr[x][y].toLowerCase());
    }
  }
  return pos;
}
mutation(["hello", "Hello"]);
Can someone help me with the "Mutations" lesson?
timb
@timb206
Jan 06 2017 05:13 UTC
you don't need ++1
++ ; should work, or so i thought
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:14 UTC
wat are you trying to do? @DevRice
Ademola Adegbuyi
@ooade
Jan 06 2017 05:14 UTC
@KarnageKnight using $.ajax would be a workaround
timb
@timb206
Jan 06 2017 05:15 UTC
@Lumexralph can you help?
DevRice
@DevRice
Jan 06 2017 05:15 UTC
@KarnageKnight The instructions say to Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:15 UTC
oh, could you be so kind as to tell me why it does not work? @ooade The GET method?
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:15 UTC
@timb206 ++ is post increment operation, the value is returned before the increment is done...... and myVar++ is okay or myVar += 1
timb
@timb206
Jan 06 2017 05:15 UTC
ok let me think through that, thanks
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:16 UTC
@DevRice returning posis returning an array that won't give you a boolean
timb
@timb206
Jan 06 2017 05:16 UTC
@lumexralph how woud it look if you tried to use ++ before myVar?
DevRice
@DevRice
Jan 06 2017 05:17 UTC
@Lumexralph I was returning pos for testing purposes
muknerd
@muknerd
Jan 06 2017 05:17 UTC
Escape Sequences in Strings is not working. the code is: var myStr= "FristLine\n'\SecondLind\'\rThirdLind"; can anybody help me what's the problem?
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:18 UTC
@DevRice since you're just expecting 2 elements in arr why don't you pick the first element and second by doing arr[0] arr[1] instead of going through the stress of for loop, you will need to check if the characters of the second element in arr before you return boolean indexOf will be useful here
Ademola Adegbuyi
@ooade
Jan 06 2017 05:19 UTC
@KarnageKnight Heres the thing: Wiki api works around well only on Wikipedia pages but it's kinda... restricted on other sites which is what we well know as CORS(Cross origin resource sharing). So it would only work fine if we use the $.ajax with a dataType of jsonp
DevRice
@DevRice
Jan 06 2017 05:19 UTC
What do you mean? @Lumexralph
muknerd
@muknerd
Jan 06 2017 05:19 UTC
@timb206 just change to "myVar++;"
Karanvir Singh
@KarnageKnight
Jan 06 2017 05:20 UTC
@ooade thanks a lot my friend. Much appreciated
CamperBot
@camperbot
Jan 06 2017 05:20 UTC
karnageknight sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 795 | @ooade |http://www.freecodecamp.com/ooade
Ademola Adegbuyi
@ooade
Jan 06 2017 05:20 UTC
@KarnageKnight You're welcome :+1:
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:21 UTC
@muknerd there should be a \\ before SecondLine and after it not'\
Ken Haduch
@khaduch
Jan 06 2017 05:21 UTC
@muknerd - make sure that you spell everything properly, for one thing. "FirstLine", "SecondLine", "ThirdLine". There should be no quotation marks within the string.
muknerd
@muknerd
Jan 06 2017 05:23 UTC
@Lumexralph thank you. it works now.
CamperBot
@camperbot
Jan 06 2017 05:23 UTC
muknerd sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 663 | @lumexralph |http://www.freecodecamp.com/lumexralph
muknerd
@muknerd
Jan 06 2017 05:24 UTC
@khaduch ya. you mentioned right point there was two typo. :D
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:24 UTC
@muknerd :+1:
Joseph
@revisualize
Jan 06 2017 05:31 UTC
HI!
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:32 UTC
@revisualize hey bro......morning here
Joseph
@revisualize
Jan 06 2017 05:34 UTC
934pm here in Seattle.
amarg26
@amarg26
Jan 06 2017 05:44 UTC

not filtering more than value for 5
```var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

newArray = oldArray.filter(function(val) {
if(newArray[val]>=5)
{
return newArray;
}
});```

RhinoTek
@RhinoTek
Jan 06 2017 05:45 UTC

Could anyone help me work this one out?

var Bike = function() {

// Only change code below this line.
var gear = 5;
this.setGear = function(change) {
gear += change;
};
this.getGear = function () {
return gear;
};
};

the gear property will not change

Tyler Beutel
@TylerBeutel
Jan 06 2017 05:45 UTC
I'm currently working on the Profile Lookup challenge, and I'm stuck. It doesn't seem to be returning anything to help me figure it out either. Can someone help? This is what I've got so far:
function lookUpProfile(firstName, prop){ // Only change code below this line for (var i; i < contacts.length; i++) { if (contacts[i].firstName == firstName) { if (contacts[i].hasOwnProperty(prop)) { return contacts[i][prop]; } else { return "No such property"; } } else { return "No such contact"; } } // Only change code above this line }
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:47 UTC
@amarg26 filter works by the callback returning a boolean true/ false
amarg26
@amarg26
Jan 06 2017 05:49 UTC
like this ??
c0d0er
@c0d0er
Jan 06 2017 05:49 UTC
I added Redux, ReacRedux cdn and React, ReactDOM cdn, why it still cannot run? anything wrong with my codepen? http://codepen.io/c0d0er/pen/VPYRqW?editors=1010
amarg26
@amarg26
Jan 06 2017 05:49 UTC

```var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

newArray = oldArray.filter(function(val) {
if(newArray[val]>=5)
{
return true;
}
});
```

Ogundele Olumide
@Lumexralph
Jan 06 2017 05:49 UTC
@RhinoTek this.setGear should assign whatever is in the function parameter to the var gear in the constructor Bike
RhinoTek
@RhinoTek
Jan 06 2017 05:49 UTC
@TylerBeutel I just did this one today and the only thing that I see is you only need 1 "else" could you wrap your code in 3 tick marks like this `? Makes it easier to read
wachirafrank
@wachirafrank
Jan 06 2017 05:49 UTC

var count = 0;

function cc(card) {
  // Only change code below this line


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
The classic counting cards challenge has withheld me from making progress, anyone who has done it right??
Ademola Adegbuyi
@ooade
Jan 06 2017 05:50 UTC

@sgittles you should start counting from 0

var i = 1

Kartikeya Gupta
@kartikeya100
Jan 06 2017 05:51 UTC
how to make a navbar like this http://startuplab.no/ ....... hamburger always and slide left
wachirafrank
@wachirafrank
Jan 06 2017 05:51 UTC
I may consider hacking brownies with JS and rewarding him/her with 100K brownie points
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:52 UTC
@TylerBeutel no such contacts should be returned when the for loop is done
Ademola Adegbuyi
@ooade
Jan 06 2017 05:53 UTC
@c0d0er document.getElementById('app') and window object dont contain ReduxThunk.default;
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:54 UTC
@amarg26 you can just do return newArray[val] > 5 that will return a boolean
Tyler Beutel
@TylerBeutel
Jan 06 2017 05:54 UTC
Sorry, how do you format code to have a black background?
Ademola Adegbuyi
@ooade
Jan 06 2017 05:55 UTC
@RhinoTek that should be something like changeGear or accelerateGear, better still :sweat_smile:
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:55 UTC
@RhinoTek gear = change
Ghulam Shabir
@ghulamshabir
Jan 06 2017 05:55 UTC
@TylerBeutel see more info link '''
CamperBot
@camperbot
Jan 06 2017 05:55 UTC
:bulb: to format code use backticks! ``` more info
Dylan Hsiao
@greedylan
Jan 06 2017 05:55 UTC

say if I have

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

I want to remove the repeated value and return

 var newArr = [1,3,2,5,4].

I guess the accumulator in .reduce would() help? any hint please?

Ogundele Olumide
@Lumexralph
Jan 06 2017 05:55 UTC
@ghulamshabir he's awake :laughing:
Ghulam Shabir
@ghulamshabir
Jan 06 2017 05:55 UTC
@Lumexralph Good Morning bro :smile:
c0d0er
@c0d0er
Jan 06 2017 05:56 UTC
@ooade then what should i do to fire this code?
Tyler Beutel
@TylerBeutel
Jan 06 2017 05:56 UTC
like this?
Ghulam Shabir
@ghulamshabir
Jan 06 2017 05:56 UTC
@Lumexralph yeah :smile: thanks for welcoming
amarg26
@amarg26
Jan 06 2017 05:56 UTC
@Lumexralph value is sorted but still prompts this : You should have filtered out all values from the array that are greater than 5
RhinoTek
@RhinoTek
Jan 06 2017 05:56 UTC
@Lumexralph Thank you. I think I get it now
CamperBot
@camperbot
Jan 06 2017 05:56 UTC
rhinotek sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 664 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:56 UTC
@greedylan nope,
amarg26
@amarg26
Jan 06 2017 05:57 UTC

```var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

newArray = oldArray.filter(function(val) {

return newArray[val] > 5;

});```

@Lumexralph
Ademola Adegbuyi
@ooade
Jan 06 2017 05:57 UTC
@c0d0er you made a typo document.getElementByid('app') should be document.getElementById('app') and comment out or delete the ReduxThunk cos it doesn't exist in the window object
Veerendra
@VeerendharEluri
Jan 06 2017 05:57 UTC
hello
c0d0er
@c0d0er
Jan 06 2017 05:59 UTC
@ooade even i correct the typo and comment out the const Provider = ReactRedux.Provider; it still cannot fire properly
Ogundele Olumide
@Lumexralph
Jan 06 2017 05:59 UTC
@amarg26 return val > 5 not newArray[val] > 5
amarg26
@amarg26
Jan 06 2017 06:00 UTC
still prompts for same ... @Lumexralph
Ogundele Olumide
@Lumexralph
Jan 06 2017 06:00 UTC
@ghulamshabir slept well? still cold?
@amarg26 i don't understand :worried:
Ademola Adegbuyi
@ooade
Jan 06 2017 06:01 UTC
@c0d0er Provider is needed. I said ReduxThunk; line 1
amarg26
@amarg26
Jan 06 2017 06:01 UTC

```var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

newArray = oldArray.filter(function(val) {

return val > 5;

});```

Ogundele Olumide
@Lumexralph
Jan 06 2017 06:01 UTC
@amarg26 oh return val <= 5
c0d0er
@c0d0er
Jan 06 2017 06:02 UTC
@ooade thanks! why do i need reduxthunk?
CamperBot
@camperbot
Jan 06 2017 06:02 UTC
c0d0er sends brownie points to @ooade :sparkles: :thumbsup: :sparkles:
:cookie: 796 | @ooade |http://www.freecodecamp.com/ooade
Tyler Beutel
@TylerBeutel
Jan 06 2017 06:02 UTC
Still stuck on "Profile Lookup", had some help from @Lumexralph and @RhinoTek ... And only managed to pass 1 test. Here is my code:
function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i; i < contacts.length; i++) {

    if (contacts[i].firstName == firstName) {
      if (contacts[i].hasOwnProperty(prop)) {
        return contacts[i][prop];
      } else {
        return "No such property";
      }   
    }
  }
  return "No such contact";
// Only change code above this line
}
amarg26
@amarg26
Jan 06 2017 06:03 UTC
@Lumexralph will you explain me how this filter is working for this code ???
var oldArray = [1,2,3,4,5,6,7,8,9,10];

var newArray = oldArray;

newArray = oldArray.filter(function(val) {

return val <= 5;

});
Ogundele Olumide
@Lumexralph
Jan 06 2017 06:03 UTC
@TylerBeutel is it No such contact or No such contacts ?
Ghulam Shabir
@ghulamshabir
Jan 06 2017 06:04 UTC
@Lumexralph yeah very cold
Tyler Beutel
@TylerBeutel
Jan 06 2017 06:04 UTC
@Lumexralph its "No such contact"
Q_zheng
@zhengbusinesscontact
Jan 06 2017 06:04 UTC
guys,plz help

function palindrome(str) {
// Good luck!
str.replace(/[^a-zA-Z0-9]/, "");
lowerCaseStr = str.toLowerCase();

array = lowerCaseStr.split("");
revArray = array.reverse();
revStr = revArray.join("");
if(revStr == str){
return true;
}
else {return false;}
}

Ademola Adegbuyi
@ooade
Jan 06 2017 06:05 UTC
@c0d0er reduxThunk is a middleware used for handling async requests. If you'll need to fetch data from an API and dispatch an action based on the data fetched, you'd probably need a middleware; it could be reduxThunk, reduxSaga, reduxObservable.... and so.. It could even be a custom middleware created by you :sweat_smile:
Liz Chen
@moist17
Jan 06 2017 06:05 UTC
@forkerino thanks for the clear explanation! : )
CamperBot
@camperbot
Jan 06 2017 06:05 UTC
moist17 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @forkerino |http://www.freecodecamp.com/forkerino
Ogundele Olumide
@Lumexralph
Jan 06 2017 06:05 UTC
@amarg26 filter is a method of an array that loops through the array from left to right, using a callback function and on each value in the array it leaves if the returned value is boolean true but removes if it's false
Ademola Adegbuyi
@ooade
Jan 06 2017 06:05 UTC
@TylerBeutel var i = 0
Tyler Beutel
@TylerBeutel
Jan 06 2017 06:06 UTC
@ooade you're kidding...
I've been stuck on it for over an hour, and that is all it was??
Ogundele Olumide
@Lumexralph
Jan 06 2017 06:06 UTC
@TylerBeutel you didn't initialize your loop var i
Tyler Beutel
@TylerBeutel
Jan 06 2017 06:07 UTC
Thanks guys!
Ademola Adegbuyi
@ooade
Jan 06 2017 06:07 UTC
@TylerBeutel Lol :smile:
It happens :wink:
Q_zheng
@zhengbusinesscontact
Jan 06 2017 06:08 UTC
str.replace(/[^a-zA-Z0-9]/, "");
lowerCaseStr = str.toLowerCase();
array = lowerCaseStr.split("");
Ogundele Olumide
@Lumexralph
Jan 06 2017 06:08 UTC
@zhengbusinesscontact you can not mutate a string you should have a variable hold that value when it's replaced the character
Dylan Hsiao
@greedylan
Jan 06 2017 06:09 UTC

say if I have

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

I want to remove the repeated value and return

 var newArr = [1,3,2,5,4].

any hint please?

Ogundele Olumide
@Lumexralph
Jan 06 2017 06:09 UTC
@zhengbusinesscontact str.replace(/[^a-zA-Z0-9]/, ""); store the returned value
Ademola Adegbuyi
@ooade
Jan 06 2017 06:10 UTC
@greedylan
var newArr = arr.reduce((acc, i) => {
  if (!acc.includes(i)) {
    acc.push(i);
  }
  return acc;
}, []);
c0d0er
@c0d0er
Jan 06 2017 06:10 UTC

@ooade in the following code, if handleAsync is an action creator, what is its specific use in the original code?
if I add following code to the original code? why are there following problems?

store.subscribe(()=>{
  console.log('code is executed: ', state.getState())
})// why doesnt log anything?? means store.dispatch(handleAsync()) did not fire??

store.dispatch(handleAsync());//should use action creator like this?

console.log(store.getState());//why shows nothing?

the following is original code

//original code
const REQUESTING_DATA = 'REQUESTING_DATA'
const RECEIVED_DATA = 'RECEIVED_DATA'

const requestingData = () => { return {type: REQUESTING_DATA} }
const receivedData = (data) => { return {type: RECEIVED_DATA, users: data.users} }

const handleAsync = () => {
return function(dispatch) {
dispatch(requestingData());
setTimeout(function() {
let data = {
users: ['Jeff', 'William', 'Alice']
}
dispatch(receivedData(data));
}, 2500);
}
};

const defaultState = {
fetching: false,
users: []
};

const asyncDataReducer = (state = defaultState, action) => {
switch(action.type) {
case REQUESTING_DATA:
return {
fetching: true,
users: []
}
case RECEIVED_DATA:
return {
fetching: false,
users: action.users
}
default:
return state;
}
};

const store = Redux.createStore(
asyncDataReducer,
Redux.applyMiddleware(ReduxThunk.default)
);
Q_zheng
@zhengbusinesscontact