8th
Mar 2017
Jason Luboff
@JLuboff
Mar 08 2017 00:00
@forkerino Cool :+1:
Pieter Stokkink
@forkerino
Mar 08 2017 00:00
@johnnunns don't ask me. I still have to write one. I saw one solution using .reduce, but forgot it because I want to come up with my own.
@GoingAllTheWayUp
Mar 08 2017 00:00
@johnnunns I started with a fairly common array, how to build it I had to look around.
Pieter Stokkink
@forkerino
Mar 08 2017 00:01
@GoingAllTheWayUp well.... The LCM of all numbers is an LCM, no?
John Nunns
@johnnunns
Mar 08 2017 00:01
I think the best way is to do an if statement from 1 to 4000 :joy:
@GoingAllTheWayUp
Mar 08 2017 00:01
But it also ask me to preform the second task, thats messing me up
Pieter Stokkink
@forkerino
Mar 08 2017 00:02
@GoingAllTheWayUp
Mar 08 2017 00:02
Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters.
CamperBot
@camperbot
Mar 08 2017 00:02
find the smallest common multiple of the provided parameters that can be evenly divided by both as well as by all sequential numbers in the range between these parameters
nothing found
Pieter Stokkink
@forkerino
Mar 08 2017 00:02
@GoingAllTheWayUp yes, so you have a range and you have to find the lcm of all of them. I took them two at a time.
Osa
@AkhatorEnosa
Mar 08 2017 00:02

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly"); how do i solve this if the question is

** wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib)

Alex
@alexlo0319
Mar 08 2017 00:03
help? anybody? I'll give you a cookie.
Pieter Stokkink
@forkerino
Mar 08 2017 00:03
Alex
@alexlo0319
Mar 08 2017 00:04
Ok, I had this : var shirtValue = testObj.jersey; and it was this : var shirtValue = testObj.shirt;
and one of the requirements requested this : The value of shirtValue should be "jersey".
Edgar Pan
@edgaryp
Mar 08 2017 00:05
cashed out this.$display =$("#display p"); but line 22 did not work. I think I used bind or apply incorrectly.
http://codepen.io/edgaryp/pen/yMeRLX?editors=1011
Alex
@alexlo0319
Mar 08 2017 00:06
This is the section : Accessing Objects Properties with the Dot Operator.
@GoingAllTheWayUp
Mar 08 2017 00:07
@forkerino I think my biggest learning curve with the "smallest-common-multiple" challenge is that I don't know how long the array for either user given number will become, becuase my original idea was to searching one array while computing out the next, collecting all those matches and subjecting them to next another test.
Pieter Stokkink
@forkerino
Mar 08 2017 00:07
@alexlo0319 yes. "jersey" is the value inside the property with the name "shirt". You can only use property names with dot and bracket notation. Not the values.
@GoingAllTheWayUp You only are given 2 numbers, you have to fill in the rest yourself.
@GoingAllTheWayUp
Mar 08 2017 00:08
like if i was to creat two arrays one from each number that plays the computation of multiples out.
Alex
@alexlo0319
Mar 08 2017 00:08
@forkerino so is shirt instead of jersey?
@GoingAllTheWayUp
Mar 08 2017 00:08
I just don't know how long it has to be
Alex
@alexlo0319
Mar 08 2017 00:09
oh I see with the other one.
Pieter Stokkink
@forkerino
Mar 08 2017 00:10
@GoingAllTheWayUp that is a very roundabout way of doing it.
Simon Cordova
@gbsimon87
Mar 08 2017 00:10
Got it! This worked :)
function truncateString(str, num) {

if ( num > 3) {

if ( str.length > num ) {
str = str.slice(0, num - 3) + "...";
}
return str;
} else {
str = str.slice(0,num) + "...";
}
return str;
}

truncateString("A-tisket a-tasket A green and yellow basket", 11);
Pieter Stokkink
@forkerino
Mar 08 2017 00:10
@edgaryp so the bug you want help with, is that it just shows the last number you pressed?
@GoingAllTheWayUp
Mar 08 2017 00:10
Im learning @forkerino that its not going to work that way.
Mar 08 2017 00:11
basic algorithm scripting seems tedious
Pieter Stokkink
@forkerino
Mar 08 2017 00:11
@GoingAllTheWayUp
Mar 08 2017 00:11
?
Alex
@alexlo0319
Mar 08 2017 00:12
@forkerino Thanks.
CamperBot
@camperbot
Mar 08 2017 00:12
alexlo0319 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 1439 | @forkerino |http://www.freecodecamp.com/forkerino
Edgar Pan
@edgaryp
Mar 08 2017 00:12
@forkerino yes. it works with this $("#display p").text(temp);. But I want to use $display
Osa
@AkhatorEnosa
Mar 08 2017 00:13
@GoingAllTheWayUp
Mar 08 2017 00:14
@AkhatorEnosa all you posted was the original FCC script outline\
Edgar Pan
@edgaryp
Mar 08 2017 00:14
@AkhatorEnosa you don't know where to start or you have written code but it doesn't work?
chazztizer
@chazztizer
Mar 08 2017 00:17
Hey all, I have a question that I just can't seem to figure out.
Osa
@AkhatorEnosa
Mar 08 2017 00:17
@edgaryp I do not know where to start
eyesore-
@eyesore-
Mar 08 2017 00:17
@chazztizer what's up?
Edgar Pan
@edgaryp
Mar 08 2017 00:19
@AkhatorEnosa replace the words in the sentence with function's arguments (myNoun, myAdjective, myVerb, myAdverb)
chazztizer
@chazztizer
Mar 08 2017 00:19

function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
args.splice(0, 1);
return arr.filter(function(element) {
return args.indexOf(element) === -1;
});
}

The args.indexOf(element) ===-1. I know that If you run indexOf and the thing you search for isn't there, then you get -1. Is this saying, if the indexOf args doesn't exist, return -1?

Edgar Pan
@edgaryp
Mar 08 2017 00:20
@AkhatorEnosa for example instead of saying "I have a car.", you would code "I have a " + myNoun + "."
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:21
@forkerino well its done and passed, messy but passed
@chazztizer no its saying return true or false
mitron6
@mitron6
Mar 08 2017 00:23
@chazztizer If element is not in args, return true.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:23
args.indexOf(element) === -1 is either true or false
Pieter Stokkink
@forkerino
Mar 08 2017 00:23
@edgaryp I think it is a scoping problem. Inside your updateResult function, this will refer to the place where the function was called (so I'm guessing one of the buttons). I'm not really an expert in going about it this way (pun intended), I don't think I used it once in my calculator project.
@HeebieGeeBee :+1:
chazztizer
@chazztizer
Mar 08 2017 00:23
Yeah I got the true or false.
Pieter Stokkink
@forkerino
Mar 08 2017 00:23
@HeebieGeeBee next up: Caesar's Cipher! in C!
chazztizer
@chazztizer
Mar 08 2017 00:23
But thanks anyways
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:23
@forkerino lol great
amazing how basic and barebones c is huh
mitron6
@mitron6
Mar 08 2017 00:24
@chazztizer So after the filter, only the elements of the array that are not passed as the 2nd, 3rd,4th, etc args will be returned.
Osa
@AkhatorEnosa
Mar 08 2017 00:24
@edgaryp Thanks boss . Finally i can move further
CamperBot
@camperbot
Mar 08 2017 00:24
akhatorenosa sends brownie points to @edgaryp :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:25
@forkerino i actually remeber my brother learning c when i was a kid and he had a textbook about 5 cm thick on it
Pieter Stokkink
@forkerino
Mar 08 2017 00:25
@HeebieGeeBee yeah, it is kinda cool, but sometimes I'm grasping for the roots of everything I know from higher order languages and it just won't work because of the simplicity of it all. But it is great to learn something like it.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:25
which kinda worries me
Edgar Pan
@edgaryp
Mar 08 2017 00:25
@forkerino yeah I am learning to structure my code... haha
Pieter Stokkink
@forkerino
Mar 08 2017 00:26
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:26
@forkerino lol yeah actually i think it was something that lookd like that
cant remember exactly butit was massive and i just remember it have a big c on it and thinking it was weird
Pieter Stokkink
@forkerino
Mar 08 2017 00:27
@HeebieGeeBee In the end our history bites us in the ass
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:28
@forkerino yup
Pieter Stokkink
@forkerino
Mar 08 2017 00:29
I'm going to bed. Have a nice one!
forkerino @forkerino is dreaming about electric sheep.
Jason Luboff
@JLuboff
Mar 08 2017 00:29
night
@GoingAllTheWayUp
Mar 08 2017 00:29
you guys ever hackerrank.com?
night dude!
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:30
@forkerino night
@GoingAllTheWayUp nope
@JLuboff oh dude you know you were saying about doing your own backend api
eyesore-
@eyesore-
Mar 08 2017 00:31
I use codewars. Do you like Hacker Rank more?
Jason Luboff
@JLuboff
Mar 08 2017 00:33
@HeebieGeeBee Yes sir
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:34
@JLuboff i was looking at the cs50 videos on youtube, and theres this one guy does a javascript bootcamp, but starts from the backend and the first like little project he starts with is doing an api hosting json
@GoingAllTheWayUp
Mar 08 2017 00:34
@eyesore- I don't know what language hackerrank is useing. ill look at codewars
Jason Luboff
@JLuboff
Mar 08 2017 00:34
@HeebieGeeBee Oh? I know that FCC does some stuff with it, but does it seem different than what FCC has?
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:35
eyesore-
@eyesore-
Mar 08 2017 00:35
@GoingAllTheWayUp I believe Hacker Rank is primarily in Java
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:35
@JLuboff its just odd that its a bootcamp for javascript starting from the basics, but starts with backend and then moves to front end
eyesore-
@eyesore-
Mar 08 2017 00:36
@JLuboff Are you writing a backend in Node? Or I guess, have you done it before?
Coy Sanders
@coymeetsworld
Mar 08 2017 00:36
@eyesore- looks like multiple languages are supported
Jason Luboff
@JLuboff
Mar 08 2017 00:36
@HeebieGeeBee Ya that is odd...I'm assuming its meant for someone with a basic understanding already?
eyesore-
@eyesore-
Mar 08 2017 00:36
@coymeetsworld yeah, but it really all gets compiled to Java
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:37
@JLuboff nope he literally starts from the basics
Coy Sanders
@coymeetsworld
Mar 08 2017 00:37
javascript gets compiled to java?
eyesore-
@eyesore-
Mar 08 2017 00:37
YEah
Jason Luboff
@JLuboff
Mar 08 2017 00:37
@eyesore- I only started the FCC backend section the other day but haven't progressed much (I still need to finish my Simon game for Front End)
@HeebieGeeBee Ok...bookmarking now
eyesore-
@eyesore-
Mar 08 2017 00:37
You will write it out in Javascript, but what actually get's put through the tests is Java
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:37
but might be good for you as gos through node and git and stuff first @JLuboff
@GoingAllTheWayUp
Mar 08 2017 00:37
@eyesore- codewars NICE!\
Coy Sanders
@coymeetsworld
Mar 08 2017 00:37
but JavaScript solutions will work @eyesore- ?
eyesore-
@eyesore-
Mar 08 2017 00:38
@coymeetsworld Yeah, they do.
Coy Sanders
@coymeetsworld
Mar 08 2017 00:38
ok
eyesore-
@eyesore-
Mar 08 2017 00:39
@JLuboff Writing a backend can actually be super simple with Node and Express. That may be actually why they start the backend since it very function heavy and there is no need to worry about pushing pixels.
Mar 08 2017 00:39
whats wrong with my factorials algorithm

function factorialize(num) {
if (num <= 1) {
return 1;
}
for (var i = 0; i < num; i++) {
num = num * i;
if(i > num) {
return num;
}
}
}

factorialize(5);

Jason Luboff
@JLuboff
Mar 08 2017 00:40
@HeebieGeeBee I need to practice git...I learned it and then forgot it heh
@eyesore- Good to know.
eyesore-
@eyesore-
Mar 08 2017 00:40
@coymeetsworld it's cool to get familiar with it because a lot of websites use it for their technical interview, but their UI isn't super intuitive. In my opinion.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:40
@JLuboff yeah its hard keeping up unless you useall this stuff all the time
@conradkay youre changing the value of num inside your loopbut the length of your loop is dependent on the size of num
eyesore-
@eyesore-
Mar 08 2017 00:41
@JLuboff I would highly suggest checking out Express after writing it out in pure Node. Oh, and for Git have you ever checked out gitimmersion.com?
Mar 08 2017 00:41
ok
Jason Luboff
@JLuboff
Mar 08 2017 00:41
@eyesore- Nope...but I can add it to my list of things to read/watch/listen/learn/etc lol
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:42
@JLuboff that 'git it' program pretty much shows you all the basics you need to know
Coy Sanders
@coymeetsworld
Mar 08 2017 00:42
@eyesore- yeah I think I had issues with it before, I forget
eyesore-
@eyesore-
Mar 08 2017 00:42
@JLuboff Haha if you are getting into Git and GitHub then I definitely recommend that. It will walk you through a ton of information.
Mar 08 2017 00:42
how bout now

function factorialize(num) {
var newnum = 0;

if (num <= 1) {
return 1;
}

for (var i = 0; i < num; i++) {
newnum *= i;

if(i >= num) {
return newnum;
}
}
}

factorialize(5);

Coy Sanders
@coymeetsworld
Mar 08 2017 00:43
I use codewars a little bit, just tried a challenge in JS for Javascript and passed it but it was easy
Jason Luboff
@JLuboff
Mar 08 2017 00:43
@HeebieGeeBee @eyesore- Thank you both.
CamperBot
@camperbot
Mar 08 2017 00:43
jluboff sends brownie points to @heebiegeebee and @eyesore- :sparkles: :thumbsup: :sparkles:
eyesore-
@eyesore-
Mar 08 2017 00:43
No Problem
Coy Sanders
@coymeetsworld
Mar 08 2017 00:43
the challenge in JS I mean just now in HackerRank
Jason Luboff
@JLuboff
Mar 08 2017 00:43
@HeebieGeeBee What time is it over there... 12:43?
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:43
1:44
Jason Luboff
@JLuboff
Mar 08 2017 00:43
Oh dang. Late night eh?
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:44
@conradkay your return is inside a conditional which it should never reach
eyesore-
@eyesore-
Mar 08 2017 00:44
@coymeetsworld In codewars you can select the difficulty when you get started. Level 4 one are when they get pretty difficult.
Mar 08 2017 00:44
thanks
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:44
@JLuboff yeah
Mitch Lembke
@mlembke1
Mar 08 2017 00:44
Hey guys, I am stuck on challenge 122. I am new to JavaScript and just don't understand. Any help would be great!
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:44

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++){
for (var k=0; k<arr[j].length; k++) {
product = product * arr[i][j][k];
}
}
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Coy Sanders
@coymeetsworld
Mar 08 2017 00:44
I see, yeah you do level up @eyesore- and you can choose whether or not to stay or level higher
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:44
well i dot sleep like normal ppl
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:44
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
can sombody help me out with this
Coy Sanders
@coymeetsworld
Mar 08 2017 00:45
I like in codewars you can see other solutions
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:45
Jason Luboff
@JLuboff
Mar 08 2017 00:45
@jay-dee7 You have one too many loops there
eyesore-
@eyesore-
Mar 08 2017 00:45
@mlembke1 What's up?
Coy Sanders
@coymeetsworld
Mar 08 2017 00:45
once you solve it yourself
Jason Luboff
@JLuboff
Mar 08 2017 00:45
@HeebieGeeBee My late nights are usually mayyybbbeee 11:30 on a weekend lol. Otherwise usually to bad 10:30ish
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:45
@mlembke1 the challenges dont have numbers they have names and showing what code you have at the moment helps
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:46
i'm not so sure about any other ways @JLuboff
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:46
@JLuboff i can have a strange sleeping pattern
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:46

function smallestCommons(arr) {
arr.sort(function(a, b) {
return b - a;
});
var newArr = [];
for (var i = arr0; i >= arr1; i--) {
newArr.push(i);
}

var quot = 0;
var loop = 1;
var n;

do {
quot = newArr0 loop newArr1;
for (n = 2; n < newArr.length; n++) {
if (quot % newArr[n] !== 0) {
break;
}
}

loop++;

} while (n !== newArr.length);

return quot;
}

smallestCommons([1,5]);

Jason Luboff
@JLuboff
Mar 08 2017 00:46
@jay-dee7 Remove your k loop and any mention of it...
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:46
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:46
so i can be up for like 20 hours then sleep for ten then stay up for another 15 hours and the sleep for 7
Jason Luboff
@JLuboff
Mar 08 2017 00:47
@HeebieGeeBee Weird
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:47
then i might be up for like 8 hours and sleep 3 hours
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:47
okay
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:47
anybodyyyy
Jason Luboff
@JLuboff
Mar 08 2017 00:47
@Pavanpavik Bro, just becuase no one answers within 10 seconds doesnt mean people aren't looking at it
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:48
@Pavanpavik on what line?
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:48
donno
Jason Luboff
@JLuboff
Mar 08 2017 00:48
@HeebieGeeBee I'm very much a routine person. I have my routine and stick to it
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:48
it is showing syntax error
Jasdeep Singh
@jay-dee7
Mar 08 2017 00:49
@JLuboff thank you so much you're awesome man
CamperBot
@camperbot
Mar 08 2017 00:49
jay-dee7 sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1063 | @jluboff |http://www.freecodecamp.com/jluboff
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:49
@Pavanpavik is there do in javascript?
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:49
yessssss
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:49
really?
eyesore-
@eyesore-
Mar 08 2017 00:49
@Pavanpavik @HeebieGeeBee There is, but they are used in while loops
@Pavanpavik @HeebieGeeBee Not in, but with while loops
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:50
so the same as in c
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:50
anybody solved smallest common multiple
algorithm
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:50
@JLuboff i can have a routine for like 2 weeks
@Pavanpavik yes
eyesore-
@eyesore-
Mar 08 2017 00:51
Does FCC have line numbers when submitting answers?
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:51
bro solution
plzzzzzzzzzzzz
eyesore-
@eyesore-
Mar 08 2017 00:51
@Pavanpavik Are you in a hurry? Relax man. What is this doing? quot = newArr0 loop newArr1;
That is going to give you an error.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:51
@Pavanpavik cant tell cus you have put it in markup but quot = newArr0 loop newArr1; looks wrong
@Pavanpavik if you just want solutions you can google them
eyesore-
@eyesore-
Mar 08 2017 00:52
Haha ^
Coy Sanders
@coymeetsworld
Mar 08 2017 00:52
or watch one of those dumb speed run videos on youtube
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:52
it is newArr[0] loopnewArr1;
kf7oaa
@kf7oaa
Mar 08 2017 00:52
Hey guys im stuck on a problem was hoping i could get some help?
Pavan kalyan K
@Pavanpavik
Mar 08 2017 00:53
what s the issue
eyesore-
@eyesore-
Mar 08 2017 00:53
@kf7oaa Which one?
kf7oaa
@kf7oaa
Mar 08 2017 00:53
im on the escape sequences in strings
i cant seem to get the escape sequences working
eyesore-
@eyesore-
Mar 08 2017 00:54
@kf7oaa what do you have so far?
icodeyouso
@icodeyouso
Mar 08 2017 00:54

can anyone explain why my code isnt passing i passed 7 of 8 tests this is the only left

testGreaterOrEqual(10) should return "10 or Over"

function testGreaterOrEqual(val) {
if (val >= 20) {  // Change this line
return "20 or Over";
}

if (val >= 11) {  // Change this line
return "10 or Over";
}

return "9 or Under";
}

// Change this value to test
testGreaterOrEqual('10');
Jason Luboff
@JLuboff
Mar 08 2017 00:55
@icodeyouso becuase val >= 11 would not pass for 10
kf7oaa
@kf7oaa
Mar 08 2017 00:55
var myStr = "FirstLine\n\SecondLine\\rThridLine"
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:55
Third*
Mar 08 2017 00:56
stuck on how to know when to return factorial
for (var i = 0; i < num; i++) {
newnum *= i;
if() {
return newnum;
}
}
what should be inside that
kf7oaa
@kf7oaa
Mar 08 2017 00:56
thanks that fixed it lol
i feel dumb now
Jason
@Hoppyguy
Mar 08 2017 00:56
Hello all,
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:56
@conradkay just trying returning the newnum after the loop
@kf7oaa dont, these things happen
Jason
@Hoppyguy
Mar 08 2017 00:57
I have run into difficulty with the "using objects for lookup" Here is what I have so far

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

// Only change code below this line

var lookup = {
bravo:"Boston",
charlie:"Chicago",
delta:"Denver",
echo:"Easy",
foxtrot:"Frank"
};

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

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

Jason Luboff
@JLuboff
Mar 08 2017 00:57
Jason
@Hoppyguy
Mar 08 2017 00:57
Thanks!
Mar 08 2017 00:57
@HeebieGeeBee still fail
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:57
@JLuboff cya
Francisco Chardin
@franchardin
Mar 08 2017 00:57
Hello, newbie here.
icodeyouso
@icodeyouso
Mar 08 2017 00:58
@JLuboff thank you..im out right
embarrassed
CamperBot
@camperbot
Mar 08 2017 00:58
icodeyouso sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
Mar 08 2017 00:58

function factorialize(num) {
var newnum = 0;

if (num < 1) {
return 1;
}

for (var i = 0; i < num; i++) {
newnum *= i;
}
return newnum;
}
factorialize(5);

CamperBot
@camperbot
Mar 08 2017 00:58
:star2: 1064 | @jluboff |http://www.freecodecamp.com/jluboff
Mar 08 2017 00:58
this is full code
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:58
@Hoppyguy you need to assign something to the result variable
Francisco Chardin
@franchardin
Mar 08 2017 00:58
how do i paste from ffc console?
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 00:59
@conradkay start the new num with 1 and the var i with one and then make it i <=num
@franchardin just highlight the code copy it and paste it here
Francisco Chardin
@franchardin
Mar 08 2017 01:00
Oh, but it looks ugly... :P
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 01:00
CamperBot
@camperbot
Mar 08 2017 01:00
:bulb: to format code use backticks!  more info
Francisco Chardin
@franchardin
Mar 08 2017 01:00
Thank you @HeebieGeeBee Herbie
CamperBot
@camperbot
Mar 08 2017 01:00
franchardin sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
Mar 08 2017 01:00
oh
Francisco Chardin
@franchardin
Mar 08 2017 01:01
xD
Coy Sanders
@coymeetsworld
Mar 08 2017 01:01
backticks on their own lines
you can edit your comment near the timestamp
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 01:02
use shift and enter to get a new line @franchardin
Mar 08 2017 01:02
@HeebieGeeBee thanks
CamperBot
@camperbot
Mar 08 2017 01:02
conradkay sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
si
@demon9181
Mar 08 2017 01:02
hi how do i get the .replace method to remove every space in my string?
Francisco Chardin
@franchardin
Mar 08 2017 01:03
Oh yeah
si
@demon9181
Mar 08 2017 01:03
for example using .replace(" ", "") only cuts out the first space
eyesore-
@eyesore-
Mar 08 2017 01:03
@demon9181 You would want to use regex for that.
Mar 08 2017 01:04
needed to make num 1 more to make up for 1 being 1
Francisco Chardin
@franchardin
Mar 08 2017 01:05
I have to do this "processed should have a value of 2
You should assign processArg to processed
"
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 01:05
@franchardin thats not what it asked you to do
@franchardin look at their example in the code
Francisco Chardin
@franchardin
Mar 08 2017 01:05
Lets see.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 01:06
if i said in their example that they have assigned change to their changed variable and changed has a value of 5
@franchardin would that help
Francisco Chardin
@franchardin
Mar 08 2017 01:09
Oh, i just have to read carefully. Silly me :shipit: . Thanks again @HeebieGeeBee .
CamperBot
@camperbot
Mar 08 2017 01:09
franchardin sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: franchardin already gave heebiegeebee points
Jason
@Hoppyguy
Mar 08 2017 01:10
@HeebieGeeBee Thanks...working on...
CamperBot
@camperbot
Mar 08 2017 01:10
hoppyguy sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
Chris Cullen
@123xylem
Mar 08 2017 01:18

Hi, Im using mongod mongoose..
Im making an edit page with a get request like so:

app.get("blogs/:id/edit",function(req,res){
blog.findById(req.params.id,function(err,newBlog){
if(err){
console.log(err);
}else{
res.render("edit",{blog:newBlog})
}     })  })

But im getting the following error!

 [CastError: Cast to ObjectId failed for value "edit" at path "_id" for model "blog"]
message: 'Cast to ObjectId failed for value "edit" at path "_id" for model "blog"',
name: 'CastError',
stringValue: '"edit"',
kind: 'ObjectId',
value: 'edit',
path: '_id',
reason: undefined,
model:

I have no idea whats going on here as it happens even if i do a simple
js app.get("blogs/edit",function(req,res){ res.render("edit"); })Get Request... WHy am I getting this cast error!!??

eyesore-
@eyesore-
Mar 08 2017 01:21
@123xylem That error is because your ObjectId is invalid. You may need to restructure your DB to what you want. I think Mongoose has a function to check if your ObjectId is valid or not mongoose.Types.ObjectId.isValid()
@123xylem IDs for databases are usually integers only.
Francisco Chardin
@franchardin
Mar 08 2017 01:25
function nextInLine(arr, item) {

return arr, item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Any thoughts? I know its basic but i cant find out how to do this.
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
HeebieGeeBee
@HeebieGeeBee
Mar 08 2017 01:30
@franchardin you need to push the item into the array and the return your shift from the array
A010
@A010
Mar 08 2017 01:33
Hi guys I'm doing the challenge Seek and Destroy but I don't have an idea how the filter() method work at all. I googled it and didn't find anything. So Can someone please direct me to a website that explains how filter() works, Thanks
Chris Cullen
@123xylem
Mar 08 2017 01:34
@eyesore- eyesore i thnk u have a point but my more info request using the elements id works
app.get("/blogs/:id",function(req,res){
blog.findById(req.params.id,function(err,newBlog){
if (err){console.log(err)}
else{ res.render("show",{blog:newBlog});}
})
});
How can they be different
{ [CastError: Cast to ObjectId failed for value "no Image" at path "_id" for model "blog"]
message: 'Cast to ObjectId failed for value "no Image" at path "_id" for model "blog"',
name: 'CastError',
stringValue: '"no Image"',
This looks to me that its looking in the image value of my element obkect for object id...
Simon Cordova
@gbsimon87
Mar 08 2017 01:38
function mutation(arr) {

var firstWord = arr[0].toLowerCase();
var secondWord = arr[1].toLowerCase();

for (var i = 0; i < secondWord.length; i++) {
return ( firstWord.indexOf(secondWord[i]) == -1 );
}

}

mutation(["hello", "he"]);
Can anyone spot my mistake?
Jakumozo
@Jakumozo
Mar 08 2017 01:38
@gbsimon87 return exits the function, so your code works just for i = 0
Simon Cordova
@gbsimon87
Mar 08 2017 01:39
I see....
Michael Bomholt
@bomholtm
Mar 08 2017 01:39
having trouble with the canvas animation of my pomodoro timer. i'm using https://github.com/kottenator/jquery-circle-progress for the animation. basically the animation is started 2 times (session + break) but if the browser tab is inactive it fails to start the animation the second time... ANY IDEAS? https://codepen.io/bomholt/full/BpBEZN/ just use 0.2 for session and break time if you want to reproduce the bug
Simon Cordova
@gbsimon87
Mar 08 2017 01:40
@Jakumozo any ideas how to not exit the function?
Oh I could use a variable
Chris Cullen
@123xylem
Mar 08 2017 01:43
@eyesore- any ideas?
Makopa
@makopa
Mar 08 2017 01:44
gooday day campers :fire: how to accest 2 or more properties in my object in a single line??? i tried this. but didnt work
var myCat = {
'name': 'Meowsalot',
'species': 'cat',
'favFood': 'tuna'
}

$('#btn').on('click',function(){ alert(myCat.species.favFood); }); *access A010 @A010 Mar 08 2017 01:44 @akshay231 Thanks, I saw the first and second links before, one was too complex and and other was too simple. I think the third one is what I want CamperBot @camperbot Mar 08 2017 01:44 a010 sends brownie points to @akshay231 :sparkles: :thumbsup: :sparkles: :cookie: 267 | @akshay231 |http://www.freecodecamp.com/akshay231 HeebieGeeBee @HeebieGeeBee Mar 08 2017 01:48 @gbsimon87 just return false if it is -1 and then just return true outside the loop Jakumozo @Jakumozo Mar 08 2017 01:49 @makopa myCat.species + myCat.favFood @makopa in your case you want to get a favFood property of myCat.species, which does not exist Simon Cordova @gbsimon87 Mar 08 2017 01:49 @HeebieGeeBee I got it thanks function mutation(arr) { var firstWord = arr[0].toLowerCase(); var secondWord = arr[1].toLowerCase(); for (var i = 0; i < secondWord.length; i++) { if ( firstWord.indexOf(secondWord[i]) == -1 ) { return false; } } return true; } mutation(["hello", "hey"]); I was stumped at returning true outside the loop, but it makes sense now. CamperBot @camperbot Mar 08 2017 01:49 gbsimon87 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles: :cookie: 987 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee Makopa @makopa Mar 08 2017 01:52 @Jakumozo thanks bro. i though can i access many properties without using concatinate! CamperBot @camperbot Mar 08 2017 01:52 makopa sends brownie points to @jakumozo :sparkles: :thumbsup: :sparkles: :cookie: 270 | @jakumozo |http://www.freecodecamp.com/jakumozo KatSaldivar @KatSaldivar Mar 08 2017 02:01 I'm struggling with the Nesting For Loops lesson. Let me send the code. Seth @sethdcd Mar 08 2017 02:02 hi guys, how would i query a piece of json data that has an object that is not static but changes based on what you search? "pages": { "4269567": { "pageid": 4269567, "ns": 0, "title": "Dog", "revisions": [ 4269567 is the id for dog so i would target it by writing data.query.pages["4269567"].title, but if i want to look something else up the id changes and this no longer works :( i tried doing data.query.pages[0].title since it's the first item in that object but no dice, any ideas? KatSaldivar @KatSaldivar Mar 08 2017 02:02 Seth @sethdcd Mar 08 2017 02:03 @KatSaldivar what happens when you get that line of code product = [i][j]? @KatSaldivar think of the objective of the challenge KatSaldivar @KatSaldivar Mar 08 2017 02:04 @sethdcd they are supposed to multiply Coy Sanders @coymeetsworld Mar 08 2017 02:04 @KatSaldivar [i][j] is nothing, you need to include the array still Seth @sethdcd Mar 08 2017 02:04 @KatSaldivar correct :) so what would you need to add to that statement to do so? KatSaldivar @KatSaldivar Mar 08 2017 02:07 @coymeetsworld @sethdcd I tried his but no luck: product = arr[i]*arr[j]; Coy Sanders @coymeetsworld Mar 08 2017 02:07 @KatSaldivar did you do the Access MultiDimensional Arrays with Indexes challenge yet? Seth @sethdcd Mar 08 2017 02:08 @KatSaldivar i think that would multiply the two values, what you want to do is target one value and multiply it to your product variable you were closer before :P Coy Sanders @coymeetsworld Mar 08 2017 02:08 you need to use that notation to access data inside the 2D array you're given also the product is when you multiple all the values together, you're just reassigning product each iteration (i.e. only using the equals sign) you need to use a different operator, I would review the Assignment with Times Equals challenge as well KatSaldivar @KatSaldivar Mar 08 2017 02:09 @coymeetsworld oooooh let me mess around with that and see what I come up with. Coy Sanders @coymeetsworld Mar 08 2017 02:09 you can see your prev solutions if you go to freecodecamp.com/yourusername sure Seth @sethdcd Mar 08 2017 02:12 does anyone know how to target json data that is a variable and not static? David Amanze @GodKingShogun Mar 08 2017 02:15 hello everyone :smile: Coy Sanders @coymeetsworld Mar 08 2017 02:16 not sure what you're asking @sethdcd David Amanze @GodKingShogun Mar 08 2017 02:17 can anyone help me with the Fibonacci challenge can anyone help me with the Fibonacci challenge Seth @sethdcd Mar 08 2017 02:17 @coymeetsworld hi guys, how would i query a piece of json data that has an object that is not static but changes based on what you search? "pages": { "4269567": { "pageid": 4269567, "ns": 0, "title": "Dog", "revisions": [ 4269567 is the id for dog so i would target it by writing data.query.pages["4269567"].title, but if i want to look something else up the id changes and this no longer works :( i tried doing data.query.pages[0].title since it's the first item in that object but no dice, any ideas? David Amanze @GodKingShogun Mar 08 2017 02:18 this is what i have so far but it is returning possible infinite loop at line five function sumFibs(num) { var finalFibs=0; var result=1; for (var i=0; i<=num; i+result) { if (i%2!==0) { finalFibs+=i; result+=i; }else if (i%2===0){ result+=i; } } return finalFibs; } Coy Sanders @coymeetsworld Mar 08 2017 02:19 not sure what lookup means you mean if you call the API again the data changes? Seth @sethdcd Mar 08 2017 02:22 @coymeetsworld right, so if i changed it from dog to cat the id would change and therefore that data.query.pages["4269567"].title doesn't work anymore since that id isn't for cat KatSaldivar @KatSaldivar Mar 08 2017 02:22 @sethdcd @coymeetsworld wohoo! got it! product *= arr[i][j]; thanks for the hints CamperBot @camperbot Mar 08 2017 02:22 katsaldivar sends brownie points to @sethdcd and @coymeetsworld :sparkles: :thumbsup: :sparkles: :cookie: 269 | @sethdcd |http://www.freecodecamp.com/sethdcd :star2: 2293 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld Coy Sanders @coymeetsworld Mar 08 2017 02:22 nice work @KatSaldivar Seth @sethdcd Mar 08 2017 02:23 @KatSaldivar nice! hugo @hramos0910 Mar 08 2017 02:28 is storing a value with the assignment operator the same as initializing it? for example var a = 0; (storing a value) var a = 0; (initializing the value) its the same right? Coy Sanders @coymeetsworld Mar 08 2017 02:30 initializing is when you first give a value to a variable hugo @hramos0910 Mar 08 2017 02:31 ok, makes sense, so if i don't give it any value.. for instance: var a; this is considered undefined right? because it has no value? @coymeetsworld Coy Sanders @coymeetsworld Mar 08 2017 02:32 yes var a; just declares that variable hugo @hramos0910 Mar 08 2017 02:32 awesome thanks! Coy Sanders @coymeetsworld Mar 08 2017 02:32 meaning it can be used, but can't really do anything until you assign it something np David Amanze @GodKingShogun Mar 08 2017 02:35 can someone look at my Fibonacci challenge. i am stumped  function sumFibs(num) { var finalFibs=0; var result=1; for (var i=0; i>num; i+result) { if (i%2!==0) { finalFibs+=i; result+=i; }else if (i%2===0){ result+=i; } } return finalFibs; } Coy Sanders @coymeetsworld Mar 08 2017 02:37 that won't work with num>= 0 I would revisit how to construct for loops, theres a couple issues with it David Amanze @GodKingShogun Mar 08 2017 02:39 @coymeetsworld true but when i try it the other way it says potential infinite loop at line five Coy Sanders @coymeetsworld Mar 08 2017 02:40 that means theres something else wrong in your code, sometimes you can have multiple issues at once Sarah Schneider @rifkegribenes Mar 08 2017 02:40 is there a way to insert a method name using the key/value pairs in the ops object? (using bignumber.js) so instead of the four statements how could i make it one statement with a variable (the method name stored at opers[op])?  function equals(num1, num2, op) { let ops = {"+": "plus", "-": "minus", "*": "mult", "/": "div"} // is there a way to turn these 4 statements into 1 using a variable? return num1.plus(num2).round(14); return num1.minus(num2).round(14); return num1.mult(num2).round(14); return num1.div(num2).round(14); // (the statement below doesn't work as written but this is what i'm trying to do) return num1.opers[op](num2).round(14); Coy Sanders @coymeetsworld Mar 08 2017 02:41 @rifkegribenes just use a switch statement, or if/else David Amanze @GodKingShogun Mar 08 2017 02:41 @coymeetsworld do you see what is wron wrong* Coy Sanders @coymeetsworld Mar 08 2017 02:41 parts of it yeah @GodKingShogun Sarah Schneider @rifkegribenes Mar 08 2017 02:42 @coymeetsworld yeah i know i can do it that way, but each of the four cases has a bunch more code attached to it, and i was hoping to find a way to not have to restate the rest of it for each case David Amanze @GodKingShogun Mar 08 2017 02:42 @coymeetsworld i love clues Coy Sanders @coymeetsworld Mar 08 2017 02:42 @GodKingShogun thats good, I gave you one David Amanze @GodKingShogun Mar 08 2017 02:42 @coymeetsworld lol dont i get three Coy Sanders @coymeetsworld Mar 08 2017 02:43 @rifkegribenes I'm not sure what other code but you can put the common code outside of the switch statement that will run regardless of what case it is Nathan Vu @NathanVu Mar 08 2017 02:43 When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: " or ' inside of your string? In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash () in front of the quote. var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get: Alan said, "Peter is learning JavaScript". Instructions Use backslashes to assign a string to the myStr variable so that if you were to print it to the console, you would see: I am a "double quoted" string inside "double quotes". I can't quite figure this out? Coy Sanders @coymeetsworld Mar 08 2017 02:43 and then inside the switch statement make the appropriate changes Nathan Vu @NathanVu Mar 08 2017 02:44 so far I have var myStr; I am a \"double quoted"\ string inside "double quotes". Sarah Schneider @rifkegribenes Mar 08 2017 02:44 @coymeetsworld it's not in the code i posted, but yeah that makes sense. i was just wondering in general if it's possible to store the name of a method in a variable and then use it later, and what the syntax would look like if that was possible Coy Sanders @coymeetsworld Mar 08 2017 02:45 yes you can @rifkegribenes, functions are first class objects in JS. You can assign them to variables let x = function() { console.log("Hey"); }; x(); //prints out "Hey" Sarah Schneider @rifkegribenes Mar 08 2017 02:47 @coymeetsworld ok so what would that look like though? if i'm storing the name of the method in the object called ops, and i want to chain the method like in the example i posted return num1.METHODNAME(num2).round(14); how would i access the method name stored in the object? Coy Sanders @coymeetsworld Mar 08 2017 02:47 idk if it will work by just storing the name acarosell1 @acarosell1 Mar 08 2017 02:47 I am looking for some advice on the "Title Case a Sentence" Basic Algorithm Challenge. While my code passes "HERE IS MY HANDLE HERE IS MY SPOUT" test, the other tests outputs do strange things to the letters. It really feels like I have encountered a genuine "bug" but I realize I may actually be doing something wrong. Here is my code: function titleCase(str) { answer =[]; var cased; var fixed; check = str.split(" "); for (i=0; i<check.length; i++){ fixed = check[i].substr((1 - check.length),1).toUpperCase() + check[i].substr(1,(check.length -1)).toLowerCase(); answer.push(fixed);} return answer.join(" "); } titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");  Coy Sanders @coymeetsworld Mar 08 2017 02:47 but I'm not sure hugo @hramos0910 Mar 08 2017 02:48 Noob alert! in module 139 converting celsius to fahrenheit.. The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32... Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit... but how? Coy Sanders @coymeetsworld Mar 08 2017 02:48 i think it can be done but its not something im familiar with Sarah Schneider @rifkegribenes Mar 08 2017 02:48 @coymeetsworld ok thanks. anybody else know the answer to that? CamperBot @camperbot Mar 08 2017 02:48 rifkegribenes sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles: :star2: 2294 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld Coy Sanders @coymeetsworld Mar 08 2017 02:49 i think you're overcomplicating the code though, even if you could I don't see why not just use a switch statement you can always improve on it later if you want but I would just implement it the way you know now Kenneth @aspire4higher Mar 08 2017 02:49 can someone give me a hint on how to do this? I'm so lost.... http://prntscr.com/ehce6w Coy Sanders @coymeetsworld Mar 08 2017 02:49 theres always going to be a better way, better not to stress it or youll never get things done thoff1331 @thoff1331 Mar 08 2017 02:53 can anyone help me with indexOf() question? function findWaldo(str){ var waldoPosition; // code below here return waldoPosition; } Waldo is hiding in some strings. You've been given a string named waldoString. Waldo will be hiding in it somewhere. Return the index of where in the string 'Waldo' starts. Nanang Hidayat @nanankhidayat Mar 08 2017 02:56 Hi, i need help for "Counting Card" task ? var count = 0; function cc(card) { // Only change code below this line switch (card){ case 2: case 3: case 4: case 5: case 6: card++; return ("5 Bet"); case 7: case 8: case 9: card = 0; return ("0 Hold"); case 10: case "J": case "Q": case "K": case "A": card--; return ("-5 Hold"); case 3: case 7: case "Q": case 8: case "A": card++; return ("-1 Hold"); case 2: case "J": case 9: case 2: case 7: card++; return ("1 Bet"); case 2: case 2: case 10: card++; return ("1 Bet"); case 3: case 2: case "A": case 10: case "K": card++; return ("-1 Bet"); } 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'); hugo @hramos0910 Mar 08 2017 02:58 guess i should always remember to review my code, ask google, then ask for help.. got it thanks!! Christopher McCormack @cmccormack Mar 08 2017 02:59 @nanankhidayat I believe you should be incrementing/decrementing count, not card Bryan Reese @breese8009 Mar 08 2017 03:05 @nanankhidayat hey can u tell me how this code works? just curious ur thought process Sara @skd726 Mar 08 2017 03:07 Hi I'm working on the "Storing Values with the Assignment Operator" and I can't assign a to b properly Bryan Reese @breese8009 Mar 08 2017 03:07 @skd726 post ur code Sara @skd726 Mar 08 2017 03:07 var a = 7; var a = var b; and I've tried with var b = var a; Bryan Reese @breese8009 Mar 08 2017 03:08 @skd726 dont use var when re assigning Sara @skd726 Mar 08 2017 03:08 just the letter? Bryan Reese @breese8009 Mar 08 2017 03:08 ya Sara @skd726 Mar 08 2017 03:08 Thanks @breese8009 !! CamperBot @camperbot Mar 08 2017 03:08 skd726 sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles: :cookie: 284 | @breese8009 |http://www.freecodecamp.com/breese8009 Bryan Reese @breese8009 Mar 08 2017 03:08 @skd726 for sure did it work? Sara @skd726 Mar 08 2017 03:09 @breese8009 it did! Bryan Reese @breese8009 Mar 08 2017 03:09 @skd726 :thumbsup: thoff1331 @thoff1331 Mar 08 2017 03:09 does anyone know how to use indexof()? Bryan Reese @breese8009 Mar 08 2017 03:09 @thoff1331 yep @thoff1331 what about it? its indexOf() btw uppercase O Usman Akram @usmanakram1996 Mar 08 2017 03:11 //code var Roman = [ ['I','II','III','IV','V','VI','VII','VIII','IX','X'], // romans for 1 till 10 ['X','XX','XXX','XL','L','LX','LXX','LXXX','XC'], // romans for 10,20,30,40,.... ['C','CC','CCC','CD','D','DC','DCC','DCCC','CM'] // romans for 100,200,300,... ]; function convertToRoman(num) { // for numbers less than 10 if(num<=10){ return findRoman(num); }else if (num > 10 ) {  var str,newString; var nw = []; str = num.toString(); var a = str[0]; newString = ""; for (var i = str.length - 1; i >= 0; i--) { newString += str[i]; } for (var k = 0 ; k < newString.length ;k++ ) { nw.push(newString[k] * Math.pow(10,k)); } //nw = nw.reverse(); return nw ; } // return arr; } convertToRoman(2787); Output i get is what to do next i got stuck help plz David Amanze @GodKingShogun Mar 08 2017 03:11 @cmccormack can you take a look at my Fibonacci code function sumFibs(num) { var finalFibs=0; var result=1; for (var i=0; result>num; i=result) { if (i%2!==0) { finalFibs+=i; result+=i; }else if (i%2===0){ result+=i; } } return finalFibs; } acarosell1 @acarosell1 Mar 08 2017 03:12  function titleCase(str) { answer =[]; var cased; var fixed; check = str.split(" "); for (i=0; i<check.length; i++){ fixed = check[i].substr((1 - check.length),1).toUpperCase() + check[i].substr(1,(check.length -1)).toLowerCase(); answer.push(fixed);} return answer.join(" "); } titleCase("sHoRt AnD sToUt"); Hello. I am looking for advice on an issue I am having with the "Title Case a Sentence" Basic Algorithm Challenge. I am passing the "HERE IS MY HANDLE HERE IS MY SPOUT" test, however the "sHoRt AnD sToUt" is returning "Rho Nnd Uto" in the console. When I just copied and pasted "Rho Nnd Uto"from the console it actually pasted "sHoRt AnD sToUt". For the "I'm a little tea pot" test the console reads "I'm A Tittl Tea Pot." While this seems like it could be a "bug" I realize that I could be doing something wrong. thoff1331 @thoff1331 Mar 08 2017 03:12 @breese8009 function findWaldo(str){ var waldoPosition; // code below here return waldoPosition; } Waldo is hiding in some strings. You've been given a string named waldoString. Waldo will be hiding in it somewhere. Return the index of where in the string 'Waldo' starts im just confused on where to start? Bryan Reese @breese8009 Mar 08 2017 03:13 @thoff1331 whats the name of the challenge? thoff1331 @thoff1331 Mar 08 2017 03:14 its called where's Waldo @breese8009. Bryan Reese @breese8009 Mar 08 2017 03:15 @thoff1331 is it an fcc challenge? sorry i guess i dont understand what u want this function to do for u thoff1331 @thoff1331 Mar 08 2017 03:16 its from another online coding course @breese8009 is there a way to post pictures here? Bryan Reese @breese8009 Mar 08 2017 03:16 @thoff1331 if u just want to find the index of the word "waldo" is that what u want it to return? thoff1331 @thoff1331 Mar 08 2017 03:17 @breese8009 it wants me to return the index of the word "findWaldo" Adam VanZuiden @adamvz Mar 08 2017 03:18 Bryan Reese @breese8009 Mar 08 2017 03:18 so u have to set a variable equal to str.indexOf('string-you-want to find starting index of') then return it Alexander Køpke @alexanderkopke Mar 08 2017 03:19 you can paste in the url of the image and it usually shows it Bryan Reese @breese8009 Mar 08 2017 03:19 oops Usman Akram @usmanakram1996 Mar 08 2017 03:19 Plz help me in roman numerals converter i mentioned the code above but nobody is looking at that :( Margaret @Margaret2 Mar 08 2017 03:20 @usmanakram1996 there might not be anyone here at the moment who has done it :frowning: Cory Hoban @Khaladin Mar 08 2017 03:20 Hello I'm having trouble understanding why this works function bouncer(arr) { return arr.filter(Boolean); // Don't show a false ID to this bouncer. } bouncer([7, "ate", "", false, 9]); does filter just know to get rid of the falsy values? Bryan Reese @breese8009 Mar 08 2017 03:21 @Khaladin in this case Usman Akram @usmanakram1996 Mar 08 2017 03:21 @Margaret2 sad life :'( Adam VanZuiden @adamvz Mar 08 2017 03:21 @usmanakram1996 have you put it your code through something like this yet? http://www.pythontutor.com/visualize.html#mode=edit Usman Akram @usmanakram1996 Mar 08 2017 03:21 my code is working fine but i want a guide on the next step what to jump on next Margaret @Margaret2 Mar 08 2017 03:22 @Khaladin i think when you do filter(Boolean) it converts all the values into their Boolean equivalents (true or false), and the way filter works is only showing stuff that returns true Bryan Reese @breese8009 Mar 08 2017 03:22 ^^^ thoff1331 @thoff1331 Mar 08 2017 03:23 @breese8009 do i need single quotes or double quotes after the indexOf? Bryan Reese @breese8009 Mar 08 2017 03:23 @thoff1331 whatever ur heart desires Margaret @Margaret2 Mar 08 2017 03:23 @usmanakram1996 can't you go to the next challenge? Bryan Reese @breese8009 Mar 08 2017 03:23 @thoff1331 wait after indexOf?? thoff1331 @thoff1331 Mar 08 2017 03:24 @breese8009 so i tried str.indexOf('findWaldo'); Bryan Reese @breese8009 Mar 08 2017 03:24 @thoff1331 post ur whole function Alexander Køpke @alexanderkopke Mar 08 2017 03:24 I must be tired. i can't even see where this findRoman function is located oO Bryan Reese @breese8009 Mar 08 2017 03:24 @thoff1331 doesnt look like u set to a var Margaret @Margaret2 Mar 08 2017 03:24 @thoff1331 you're supposed to be finding Waldo, not findWaldo Bryan Reese @breese8009 Mar 08 2017 03:24 lol common mistake i didnt see it either lol thoff1331 @thoff1331 Mar 08 2017 03:25 function findWaldo(str){ var waldoPosition; // code below here return waldoPosition; Usman Akram @usmanakram1996 Mar 08 2017 03:26 @Margaret2 no beacuse roman is left and i got stuck here Margaret @Margaret2 Mar 08 2017 03:26 @thoff1331 so waldoPosition needs to be the index of the word "Waldo" in the string Ken Haduch @khaduch Mar 08 2017 03:27 @usmanakram1996 - it looks like you are breaking the number down in to the values that would map into your arrays of Roman Number values - you should think of how to do that - say, the values that you posted: var Roman = [ ['I','II','III','IV','V','VI','VII','VIII','IX','X'], // romans for 1 till 10 ['X','XX','XXX','XL','L','LX','LXX','LXXX','XC'], // romans for 10,20,30,40,.... ['C','CC','CCC','CD','D','DC','DCC','DCCC','CM'] // romans for 100,200,300,... ]; And the output that you are getting: [8, 80, 700, 2000] Seems that you should be able to fairly easily get the value for 8 from the ['I','II','III','IV','V','VI','VII','VIII','IX','X'], // romans for 1 till 10 array by subtracting 1 from it, that will give you the index 7 which would access VIII. Same thing for the 80 - you can just scale it by dividing by 10 and subtracting 1, etc. The thousands values you just concatenate MM for each thousand units in the thousands number. thoff1331 @thoff1331 Mar 08 2017 03:27 @Margaret2 so waldoPosition goes inside of the parenthesis? Bryan Reese @breese8009 Mar 08 2017 03:27 @thoff1331 u didnt do anything i told u to lol Margaret @Margaret2 Mar 08 2017 03:27 @thoff1331 no @thoff1331 once you get the index value, store it in the waldoPosition variable like bryan said bigsam0899 @bigsam0899 Mar 08 2017 03:28 hi all, how to map values by parameters that passed to the function? // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { if (myObj.hasOwnProperty(checkProp)) return myObj; else return "Not Found"; } // Test your code by modifying these values checkObj("gift"); Margaret @Margaret2 Mar 08 2017 03:28 @khaduch to the rescue!! :sunglasses: @bigsam0899 why are you returning the whole object? Bryan Reese @breese8009 Mar 08 2017 03:28 @bigsam0899 u have alot of issues with this Ken Haduch @khaduch Mar 08 2017 03:29 @Margaret2 - :wave: How're you doing? bigsam0899 @bigsam0899 Mar 08 2017 03:29 I want this return myObj.checkProp; but it does not work Margaret @Margaret2 Mar 08 2017 03:29 ok, you? @khaduch :D Mridul @mridulmishra22 Mar 08 2017 03:29 Why it isn't run as VI Bryan Reese @breese8009 Mar 08 2017 03:29 @bigsam0899 u dont want to do that way Margaret @Margaret2 Mar 08 2017 03:29 @bigsam0899 if you have a variable, you have to use bracket notation, not dot notation thoff1331 @thoff1331 Mar 08 2017 03:30 str.indexOf("waldoPosition"); @Margaret2 like that? Bryan Reese @breese8009 Mar 08 2017 03:30 @thoff1331 yea but are u sure thats the string u want to find the the index of? bigsam0899 @bigsam0899 Mar 08 2017 03:30 oic, thanks @breese8009 @Margaret2 CamperBot @camperbot Mar 08 2017 03:30 bigsam0899 sends brownie points to @breese8009 and @margaret2 :sparkles: :thumbsup: :sparkles: :star2: 1925 | @margaret2 |http://www.freecodecamp.com/margaret2 :cookie: 285 | @breese8009 |http://www.freecodecamp.com/breese8009 Bryan Reese @breese8009 Mar 08 2017 03:31 @bigsam0899 that wont fix ur code tho Margaret @Margaret2 Mar 08 2017 03:31 @thoff1331 no, indexOf will find the position of the word you put in the parentheses. You need to find the word "Waldo", not "waldoPosition" Bryan Reese @breese8009 Mar 08 2017 03:31 u have a bunch more issues @Margaret2 i think he wants the position of Ken Haduch @khaduch Mar 08 2017 03:31 @mridulmishra22 - when you do the charAt, you are getting a string value, and your switch / case values are all integers. Margaret @Margaret2 Mar 08 2017 03:32 @breese8009 hence the indexOf :unamused: thoff1331 @thoff1331 Mar 08 2017 03:32 @breese8009 in the checkmark section it says that "FindWaldo" should return a value of 22 Bryan Reese @breese8009 Mar 08 2017 03:33 oh hahah @Margaret2 read ur comment wrong completely wrong lmao my bad Margaret @Margaret2 Mar 08 2017 03:33 np :D Ken Haduch @khaduch Mar 08 2017 03:33 @mridulmishra22 - so try switch( Number(un)) - it should do better. Bryan Reese @breese8009 Mar 08 2017 03:34 @thoff1331 yes..."FindWaldo" not "waldoPosition" like u have Margaret @Margaret2 Mar 08 2017 03:34 @thoff1331 example str.indexOf("dolphin") will look for the word "dolphin" :dolphin: thoff1331 @thoff1331 Mar 08 2017 03:34 that goes after return? findwaldo goes after return? Bryan Reese @breese8009 Mar 08 2017 03:35 @thoff1331 sir Margaret @Margaret2 Mar 08 2017 03:35 @thoff1331 why would you do that Bryan Reese @breese8009 Mar 08 2017 03:35 we have given u the answer @thoff1331 if u cant figure it out at this point, id say go back and re read ur prolly not ready for this no offense... ive had to go back an re learn shit 100s of times not a big deal but it doesnt matter if u get the challenge right...what matter is that u know why and how if u dont know what u did...its pointless Emily Sperry @sperrye Mar 08 2017 03:37 Hey all. I'm trying to install bootstrap and I keep getting 'Uncaught error: Bootstrap's JavaScript requires jQuery'. I checked the order of all the tags and it looks right compared to the starter template on getboostrap.com... Here's the code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" type="text/css" href="file:///C:/Users/sperrye/Desktop/giftregistry/static/styles/style.css"> <link rel="stylesheet" type="text/css" href="file:///C:/Users/sperrye/Desktop/giftregistry/bootstrap/css/bootstrap.min.css"> <title>Gift Registry</title> </head> <body> <script src="file:///C:/Users/sperrye/Desktop/giftregistry/bootstrap/js/bootstrap.min.js"> There should be something here. <div class="container"> <div class="row"> <div class="col-sm-6"> <span class="jumbotron">Gift Registry</span> </div> </div> <div class="row"> <div class="col-sm-6"> <input name=""/><input name=""/> </div> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> </body> </html> When I load the page in Chrome it's just completely blank. Ken Haduch @khaduch Mar 08 2017 03:40 @sperrye - you have to load jquery before you load bootstrap.js - just move the bootstrap.js down to the bottom after jquery. Chris Cullen @123xylem Mar 08 2017 03:41 @eyesore- thanks CamperBot @camperbot Mar 08 2017 03:41 123xylem sends brownie points to @eyesore- :sparkles: :thumbsup: :sparkles: :cookie: 77 | @eyesore- |http://www.freecodecamp.com/eyesore- Emily Sperry @sperrye Mar 08 2017 03:41 thanks @khaduch CamperBot @camperbot Mar 08 2017 03:41 sperrye sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star2: 2593 | @khaduch |http://www.freecodecamp.com/khaduch Chris Cullen @123xylem Mar 08 2017 03:41 @daemedeor thanks CamperBot @camperbot Mar 08 2017 03:41 123xylem sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles: :cookie: 668 | @daemedeor |http://www.freecodecamp.com/daemedeor JenimDacket @JenimDacket Mar 08 2017 03:46 I do not understand the madlibe java script challenge at all astray-wolf @astray-wolf Mar 08 2017 03:47 Ken Haduch @khaduch Mar 08 2017 03:47 @sperrye - looks like you are using an old version of jquery there? Just in case something odd doesn't work, or check that the version of bootstrap that you're using doesn't depend on a newer version of jquery? astray-wolf @astray-wolf Mar 08 2017 03:47 hello can someone point out where i went wrong? Adam VanZuiden @adamvz Mar 08 2017 03:48 @astray-wolf you made checkprop a string inside of you if statement so it is only looking to see if has a property named "checkprop" instead of the argument passed to the function assigned to checkprop Ken Haduch @khaduch Mar 08 2017 03:49 @astray-wolf - when you want to use the value that is contained in the variable checkProp - you cannot write it as "checkProp" - that's a string value that is not going to work in this problem. Remove the quotes from that string and try again. astray-wolf @astray-wolf Mar 08 2017 03:50 alrightttt i understand thanks so much!! solankivir @solankivir Mar 08 2017 03:50 function isLess(a, b) { // Fix this code return a === b; } // Change these values to test isLess(10, 15); 1)isLess(10,15) should return true 2)isLess(15,10) should return false 3)You should not use any if or else statements who first task is getting wrong Adam VanZuiden @adamvz Mar 08 2017 03:51 @solankivir you should be checking to see if the first argument is less than the second argument. Ken Haduch @khaduch Mar 08 2017 03:51 @solankivir - do you know what the javascript operator is for checking less than? You should try to use it in the place where it says "fix this code"... Adam VanZuiden @adamvz Mar 08 2017 03:52 @solankivir you can use an operator to check for that. eswhy @eswhy Mar 08 2017 03:52 Hello I am working on the Chunky Monky basic algorithm and am wondering if you can slice an array at multiple indexes? Adam VanZuiden @adamvz Mar 08 2017 03:53 Kenneth @aspire4higher Mar 08 2017 03:54 I'm stuck .... how do I get this http://prntscr.com/ehcsu4 to multiply all the numbers in the arrays? JenimDacket @JenimDacket Mar 08 2017 03:54 hewp Kenneth @aspire4higher Mar 08 2017 03:54 does it have to be a nested for loop? Ken Haduch @khaduch Mar 08 2017 03:54 @eswhy - I'm not sure that it works as I'm thinking you want it to - you can give a start and end value, but not multiple different places to slice it up @aspire4higher - without looking - yes, a nested for loop... (And I looked, and you DO need a nested for loop) @aspire4higher - also, for posting short code snippets here - read this: https://forum.freecodecamp.com/t/markdown-code-formatting/18391 - using Markdown format to post the code. Andrew Shieh @andrewlikes Mar 08 2017 03:56 function factorialize(num) { if (num === 0) { return 1; } return num * factorialize(num - 1); } factorialize(5); Hey guys, i'm just trying to wrap my head around this. I know the If statement was necessary because the factorial of 0 should return 1, but I don't understand the logic that goes on in the second return instance. It doesn't say to me "5 * 4 * 3 * 2 * 1" Adam VanZuiden @adamvz Mar 08 2017 03:56 @aspire4higher yes it does have to be nested. follow the example in the instructions and apply it to your code. Essentially what you are doing is working through all of the values inside of each of the arrays. Ken Haduch @khaduch Mar 08 2017 03:57 @andrewlikes - It doesn't? eswhy @eswhy Mar 08 2017 03:57 @adamvz nah what i am asking about isnt contained on that page JenimDacket @JenimDacket Mar 08 2017 03:58 hewp Andrew Shieh @andrewlikes Mar 08 2017 03:58 i'm guessing it has something to do with returning a function to a function JenimDacket @JenimDacket Mar 08 2017 03:58 prz Adam VanZuiden @adamvz Mar 08 2017 03:58 @eswhy I misunderstood your question. No the .splice will not start and stop in multiple places. Ken Haduch @khaduch Mar 08 2017 03:58 @andrewlikes - you can try running your code on http://pythontutor.com/javascript.html#mode=display and see what happens - it's a neat tool, and should be useful for a small problem like this one. Feya Shah @fshah21 Mar 08 2017 03:59 How to access an element in a form element like input into javascript eswhy @eswhy Mar 08 2017 04:00 @khaduch yeah you are right, how do you think I should go about chopping up an array with 7 indexes into a two-dimensional array with 4 equal arrays in it? Ken Haduch @khaduch Mar 08 2017 04:00 @JenimDacket - why don't you post your question, or did you already post it? Adam VanZuiden @adamvz Mar 08 2017 04:00 @feya are you using jquery? JenimDacket @JenimDacket Mar 08 2017 04:00 @khaduch I did post it haha Kenneth @aspire4higher Mar 08 2017 04:00 k thanks @adamvz CamperBot @camperbot Mar 08 2017 04:00 aspire4higher sends brownie points to @adamvz :sparkles: :thumbsup: :sparkles: :cookie: 274 | @adamvz |http://www.freecodecamp.com/adamvz eswhy @eswhy Mar 08 2017 04:00 @adamvz no worries, how do you think I should go about chopping up an array with 7 indexes into a two-dimensional array with 4 equal arrays in it? JenimDacket @JenimDacket Mar 08 2017 04:00 I am having trouble with the madlib challenge Ken Haduch @khaduch Mar 08 2017 04:00 @eswhy - a loop that runs enough times to get all of the pieces of the array and pushes them into your final result... JenimDacket @JenimDacket Mar 08 2017 04:01 I do not understand how to solve it. I do not even understand what the hell it wants from me..... Ken Haduch @khaduch Mar 08 2017 04:01 @JenimDacket - what kind of trouble? Andrew Shieh @andrewlikes Mar 08 2017 04:01 @khaduch WOW this is awesome, thanks for sharing! CamperBot @camperbot Mar 08 2017 04:01 andrewlikes sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles: :star2: 2594 | @khaduch |http://www.freecodecamp.com/khaduch JenimDacket @JenimDacket Mar 08 2017 04:01 @khaduch I literally do not understand what it wants me to do. At all. Ken Haduch @khaduch Mar 08 2017 04:02 @JenimDacket - what have you tried - you didn't post any code? JenimDacket @JenimDacket Mar 08 2017 04:02 I have had no problem up until now, and I do not understand. I'm not even sure what I do not understand. It is driving me f**ing crazy function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) { var result = ""; // Your code below this line myNoun = "dog "; myAdjective = "big "; myVerb = "ran "; myAdverb = "quickly "; result = myAdjective + myNoun + myVerb + myAdverb; // Your code above this line return result; } // Change the words here to test your function wordBlanks("dog", "big", "ran", "quickly"); Andrew Shieh @andrewlikes Mar 08 2017 04:02 I had a feeling the if statement caused it to loop back and forth ~_~ Ken Haduch @khaduch Mar 08 2017 04:02 @andrewlikes - did it work? Adam VanZuiden @adamvz Mar 08 2017 04:03 @JenimDacket you shouldn't be reassigning the arguments JenimDacket @JenimDacket Mar 08 2017 04:03 So that solves the first objective, but does not help AT ALL with the third objective Andrew Shieh @andrewlikes Mar 08 2017 04:03 @khaduch yes! would it be cheating if I used this to check all my work? it's so nice seeing it play by play JenimDacket @JenimDacket Mar 08 2017 04:03 again, I do NOT UNDERSTAND WHAT THE F** IS GOIN ON HEEAA......... Adam VanZuiden @adamvz Mar 08 2017 04:03 @JenimDacket the point of that challenge is that someone can give you any input and you build a script that makes a sentence out of it. JenimDacket @JenimDacket Mar 08 2017 04:04 TEACH ME Adam VanZuiden @adamvz Mar 08 2017 04:05 @JenimDacket well you need to take the arguments and add them together with some extra words to make a coherent sentence. So the first words passed are "dog","big","ran","quickly" Ken Haduch @khaduch Mar 08 2017 04:05 @JenimDacket - okay - first BIG problem - you are changing your variables inside the function. That is wrong, and not necessary. The function call wordBlanks("dog", "big", "ran", "quickly"); binds (if I may use that word) the values of the function arguments to the values in the function call. So, within your function myNoun will have the value "dog", myAdjective will have the value "big", etc. You just use the variable names to concatenate together to form a sentence, but you also have to add a space between each word, so you put + ' ' + to connect each variable with a literal space character. JenimDacket @JenimDacket Mar 08 2017 04:05 Right, and I did that, now? *no? Adam VanZuiden @adamvz Mar 08 2017 04:06 @JenimDacket no you reassigned the arguments so I can't pass any new ones like "cat","small","slept","quietly" @JenimDacket the idea is that I pass any new words into the function and your function will spit out a sentence that makes sense. JenimDacket @JenimDacket Mar 08 2017 04:07 Okay, so why the hell isn't this something that was explained anywhere in any of the challenges/ educational bits before hand. Or maybe I am just ahalf a brain Adam VanZuiden @adamvz Mar 08 2017 04:07 so you need to COUGH add those arugments together. JenimDacket @JenimDacket Mar 08 2017 04:08 And so you add/change those words in the wordblanks() section? Ken Haduch @khaduch Mar 08 2017 04:08 @andrewlikes - you can use that anytime you want - it's perfectly acceptable to use tools that show how your code runs and examine the operation of it step by step - similar to using the browser's devtools debugger to step through your code. The important thing is to write your own code, debugging / testing can happen any number of ways. Adam VanZuiden @adamvz Mar 08 2017 04:09 @JenimDacket you shouldn't be changing any of those words. It's going to check a bunch of different words. So assume that those words will be changed automatically when you run it. eswhy @eswhy Mar 08 2017 04:09 @khaduch i was thinking the same thing except i cannot get my code to return the full array only the the array that i specified with the beg and end points with .slice....here is what I am trying function chunkArrayInGroups(arr, size) { var ans=[]; for (i = 0; i<arr.length; i++){ ans.push(arr.slice(size)); } return ans; chunkArrayInGroups(["a", "b", "c", "d"], 2); Adam VanZuiden @adamvz Mar 08 2017 04:10 @JenimDacket you did learn those skills earlier when you were concatenating strings. JenimDacket @JenimDacket Mar 08 2017 04:10 not the spacing bit. Maybe it should have been common sense. I don't know. js is frustrating me. It's k though. Thanks @adamvz for the help. <3 CamperBot @camperbot Mar 08 2017 04:11 jenimdacket sends brownie points to @adamvz :sparkles: :thumbsup: :sparkles: :cookie: 275 | @adamvz |http://www.freecodecamp.com/adamvz Adam VanZuiden @adamvz Mar 08 2017 04:11 @JenimDacket no problem if you are still struggling with it post your code here. But in your function you should not be reassigning the arguments. Ken Haduch @khaduch Mar 08 2017 04:11 @JenimDacket - this was explained in various ways through previous lessons, I'm pretty sure. "Passing Values to Functions with Arguments" was to show the mechanics of how variable values are passed into a function and should be used. Concatenation of values to form a string was used in many exercises, this exercise just puts a couple concepts together. It happens a number of times in the sequence of lessons, and a lot of people get confused by things when you have to put a few concepts together. Frustration is good - I think it helps the learning process somewhat, but you have the resources of the chatroom to help, too... JenimDacket @JenimDacket Mar 08 2017 04:13 @adamvz , okay, I will try to keep that clear in my head. @khaduch right.. hahah I will most likely be back here soon! haha Ken Haduch @khaduch Mar 08 2017 04:13 @eswhy - well, you have to "step" through the array and pick the different starting points, because .slice() returns the piece of the array that you want, and does not modify the original array. So you might have to start at index 0, then 2, then 4, etc. if you are picking 2 element subsections of the array. Conor Murphy @cmurphy580 Mar 08 2017 04:13 is there any to target the placehodler so i can bring it closer to the bottom of the input? http://codepen.io/cmurphy580/pen/JbXzJE Ken Haduch @khaduch Mar 08 2017 04:14 @JenimDacket - I've been helping in these rooms a long time - some of the concepts definitely throw people for a loop (sometimes even a for loop...) ;) Good luck! Adam VanZuiden @adamvz Mar 08 2017 04:14 @khaduch have you even been thrown a while loop? Ken Haduch @khaduch Mar 08 2017 04:14 @adamvz - once in a while... :) Adam VanZuiden @adamvz Mar 08 2017 04:15 @cmurphy580 which placeholder? Conor Murphy @cmurphy580 Mar 08 2017 04:15 the one in the input on the hme page JenimDacket @JenimDacket Mar 08 2017 04:15 Before I lose my brain in word stuff What are arrays used for in practical situations? eswhy @eswhy Mar 08 2017 04:16 @khaduch right so how can i specify another starting point? the moz developer shows only beg point and end point as being parameters? Adam VanZuiden @adamvz Mar 08 2017 04:16 @JenimDacket TONS of things. Any time you want easily indexed information. Ken Haduch @khaduch Mar 08 2017 04:17 @eswhy - within the loop, you are generating new indices. You can use those as new starting points, huh? The thing that you might find useful is the increment your index variable i += size as a hint. Conor Murphy @cmurphy580 Mar 08 2017 04:17 @adamvz the one in the input on the hme page Adam VanZuiden @adamvz Mar 08 2017 04:17 @cmurphy580 I don't think I am understanding fully...do you mean the input for the search? JenimDacket @JenimDacket Mar 08 2017 04:18 I think part of the problem is that they keep saying, "do this! cool, now do this! and then you can also do this!", but they fail to provide any context about WHAT any of this actually does or looks like in the greater sense of coding I'm also an infant of the mind, so that might be a limiting factor Conor Murphy @cmurphy580 Mar 08 2017 04:19 yah! there @adamvz is text inside the input that says "search wikipedia" but it's not in the position i want it. Any ideas? Adam VanZuiden @adamvz Mar 08 2017 04:19 @JenimDacket keep hacking away at it. Once you get further in you will put most of the skills to use in the algorithm challenges and the projects @cmurphy580 you can apply css to it. Ken Haduch @khaduch Mar 08 2017 04:22 @cmurphy580 - when I type something in your search input on the initial load of the page, I cannot see the text? JenimDacket @JenimDacket Mar 08 2017 04:23 @adamvz Okay. Thanks for the support fam <3 CamperBot @camperbot Mar 08 2017 04:23 jenimdacket sends brownie points to @adamvz :sparkles: :thumbsup: :sparkles: :warning: jenimdacket already gave adamvz points Adam VanZuiden @adamvz Mar 08 2017 04:24 @cmurphy580 are you trying to move the position of the placeholder text? And the typed text? If so you apply css to it and change the padding of it. @JenimDacket no problem! Ken Haduch @khaduch Mar 08 2017 04:25 @cmurphy580 - I also cannot see the placeholder text - after I load something and the search box moves up to the "navbar" position, then it looks fine? Do you also see that, or is it just me? It seems that if I turn the padding: 20px 50px; setting off (in browser devtools) then I can see the text. Conor Murphy @cmurphy580 Mar 08 2017 04:30 @khaduch thats not good. I'll take a look at that! @adamvz I'll try working on the padding but it usually adjusts the size of the input. I'll keep messing with it though! Thanks for the help! CamperBot @camperbot Mar 08 2017 04:30 cmurphy580 sends brownie points to @khaduch and @adamvz :sparkles: :thumbsup: :sparkles: :star2: 2595 | @khaduch |http://www.freecodecamp.com/khaduch :cookie: 276 | @adamvz |http://www.freecodecamp.com/adamvz Adam VanZuiden @adamvz Mar 08 2017 04:32 @cmurphy580 I think it might be a line-height setting.... I am not sure though. Julio Valenzuela Jr. @juliovalen Mar 08 2017 04:33 I have to Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.  // Setup function abTest(a, b) { // Only change code below this line console.log(a <= 0); console.log(b <=0); // Only change code above this line return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2)); } // Change values below to test your code abTest(1,2); Joseph @revisualize Mar 08 2017 04:33 @juliovalen You're not supposed to console.log @juliovalen You're supposed to create an if else block. @juliovalen and you're supposed to return undefined HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:34 and? Joseph @revisualize Mar 08 2017 04:34 @juliovalen Console.log doesn't exit the function. It just logs shit to the console. Ken Haduch @khaduch Mar 08 2017 04:35 @cmurphy580 - just FYI - I'm using FireFox - if you are using a different browser, perhaps something different is happening... let me pop it into Chrome and see? Yeah, it looks completely different in Chrome, browser differences apparently? Joseph @revisualize Mar 08 2017 04:35 @juliovalen Also. if a or b are less than 0 ... It doesn't say anything about less than or equal to. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:35 there it is nice @revisualize Julio Valenzuela Jr. @juliovalen Mar 08 2017 04:36 @revisualize right ok let me try again ... thnk you HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:36 @revisualize hows things? Joseph @revisualize Mar 08 2017 04:37 @HeebieGeeBee Okay. Still thinking about how I want to structure my data for Sum Prime Numbers HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:38 you going higher order on it? es6 Joseph @revisualize Mar 08 2017 04:38 First I just want to solve it. I'm thinking I'm going to do an array of arrays. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:38 all the fancy stuff Joseph @revisualize Mar 08 2017 04:39 I think I'm going to do something like this: ["total", [2,2], [3,5], [5,10], [7,17] ....] Where the first array element is the running total. Then the prime , the total to that element. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:40 what are the other arrays? Joseph @revisualize Mar 08 2017 04:41 2 is a prime, 3 is a prime, 2+3 is 5, 5 is a prime, 5+5 is 10 ... 7 is a prime 10+7 ... That way I don't have to recompute. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:42 sounds complicated but im sure you'll get it done Joseph @revisualize Mar 08 2017 04:42 What happens if you want to run the function 40 times? You don't want to have to recompute the primes each time. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:44 so youre going to hard code that array? Joseph @revisualize Mar 08 2017 04:44 No. I'm going to let the program do that. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:44 so wont that mean the program will have to recompute it everytime anyway? Joseph @revisualize Mar 08 2017 04:45 @HeebieGeeBee Not if you do all of your function calls in the same execution process. Global Variables don't reset. At least not from what I understand with FCC. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:46 so the array is going to be aglobal variable? Joseph @revisualize Mar 08 2017 04:46 Yeah. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:48 well good luck sir will be interesting to see what you come up with when you get ti done cus sounds complex to me Adam VanZuiden @adamvz Mar 08 2017 04:50 @revisualize you are going about that a much different way than I would. It sounds interesting though. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:50 i just wrote program in c that printed the initials in uppercase letters when someone inputs their full name so thats the level im on at the moment @adamvz he makes his solutions bulletproof Joseph @revisualize Mar 08 2017 04:52 @adamvz I'm just thinking about what happens if you want to run the function 50 times in a row. How can I speed up maybe not the first run. But, the 30th Adam VanZuiden @adamvz Mar 08 2017 04:53 Oh no doubt. I am trying to wrap my head around the arrays. Joseph @revisualize Mar 08 2017 04:54 If I calculate all the way up to 247 .. then on my next run I need to calculate to 88 ... I can just look for the prime number that is larger than 88. whatever index that is. -1 and I have my total. Adam VanZuiden @adamvz Mar 08 2017 04:54 Please don't think I was criticizing I like to see the way other people solve problems to learn/experience new concepts. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:55 @revisualize maybe an object could be better for it Adam VanZuiden @adamvz Mar 08 2017 04:56 @revisualize GOT IT! Makes total sense now. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:56 dunno how global objects are in fcc though Joseph @revisualize Mar 08 2017 04:56 @HeebieGeeBee If I did an object, I'd then need to create an array from the Object.keys That's seems a little pointless. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:57 why would you? Joseph @revisualize Mar 08 2017 04:57 You'll see. It'll take me a little while to hash the code out. HeebieGeeBee @HeebieGeeBee Mar 08 2017 04:58 k nevermind Joseph @revisualize Mar 08 2017 04:59 I don't know what the lookup time on a hash table is vs an array. Hmm. @HeebieGeeBee That thought actually got me thinking.. What about a hashtable? But, meh. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:00 just get it working how you first thought @revisualize did you do this cs50 course? Joseph @revisualize Mar 08 2017 05:02 @HeebieGeeBee I did in 2009 / 2010. It's grown a LOT. I heard it's really good. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:02 oh ok yeah it is great production value they got that havard money its just at the moment i dont see whats meant to be taking me a week Andrew Shieh @andrewlikes Mar 08 2017 05:04 function palindrome(str) { //Need to remove UNDERSCORES if (str.replace(/\W/g, '').toLowerCase().split('').reverse().join('') === str.replace(/\W/g, '').toLowerCase()) { return true; } else { return false; } } palindrome("_eye"); Palindrome challenge. I managed to remove all non-alphanumeric characters except the underscores... fail. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:04 but i guess the weeks are starting off slow @andrewlikes then add them to the regex Conor Murphy @cmurphy580 Mar 08 2017 05:05 @khaduch didn't know that. Keep an eye on that. tylerccarson @tylerccarson Mar 08 2017 05:05 Enabled the Twitter button, but won’t display my quote properly. Suggestions? http://codepen.io/tylerccarson/pen/NdZQPz Conor Murphy @cmurphy580 Mar 08 2017 05:05 @adamvz i'll look into that @adamvz thanks CamperBot @camperbot Mar 08 2017 05:05 cmurphy580 sends brownie points to @adamvz :sparkles: :thumbsup: :sparkles: :warning: cmurphy580 already gave adamvz points HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:06 @tylerccarson tweet button doesnt seem to work Tom @Bort707 Mar 08 2017 05:06 having issues with this one tylerccarson @tylerccarson Mar 08 2017 05:06 Does it at least open the Twitter page for you with text reading “undefined” @HeebieGeeBee HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:07 @tylerccarson nope have you saved it? there no link to twitter anywhere in your code tylerccarson @tylerccarson Mar 08 2017 05:07 Hm okay try again HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:08 @Bort707 maybe check where your spaces are, but cant tell from the picture Andrew Shieh @andrewlikes Mar 08 2017 05:08 @HeebieGeeBee of course, thanks! btw my code looks super clunky, should I have just seperated the regex or did I do it correctly? CamperBot @camperbot Mar 08 2017 05:08 andrewlikes sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles: :cookie: 988 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee John B @JBIV Mar 08 2017 05:08 @Bort707 - It looks like your issue is there is no space between the " after quoted\ and string. Just put a space between \qouted"string so it's \quoted" string. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:09 @andrewlikes looks fine to me except you dont need the if statement just return the thing you have in parenthesis John B @JBIV Mar 08 2017 05:09 Oh and also after the backslash on inside. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:10 @tylerccarson its undefined becuase youre out of scope but that function inside you get json Andrew Shieh @andrewlikes Mar 08 2017 05:11 @HeebieGeeBee oh right since it's checking to see if both sides are equal to eachother, it's going to give back boolean data, got it! Joseph @revisualize Mar 08 2017 05:12 @Bort707 You know you're missing some spaces. Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:13 Hi , can anyone help me please! Roxroy @roxroy Mar 08 2017 05:13 @SewwandiD , what's up? John B @JBIV Mar 08 2017 05:13 @SewwandiD - We can't help if we don't know what you need help with. Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:13 // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { if(myObj.hasOwnProperty(checkProp)==="true");{ return myObj[checkProp]; } }else { return "Not Found"; } // Test your code by modifying these values checkObj("gift"); Still an error!! HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:14 @SewwandiD remove the ; after the if conditional Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:15 @HeebieGeeBee Done..but still..it's something with my else word.. Roxroy @roxroy Mar 08 2017 05:15 @SewwandiD , .... "true"); remove the semicolon Ogundele Olumide @Lumexralph Mar 08 2017 05:15 @SewwandiD you can also remove the === "true" i the condition, a boolean is already returned HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:15 is Not found or Not Found? Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:15 @roxroy Done..but still..it's something with my else word.. @roxroy Ogundele Olumide @Lumexralph Mar 08 2017 05:15 @HeebieGeeBee bro! good morning Manish Giri @Manish-Giri Mar 08 2017 05:16 @Lumexralph @HeebieGeeBee :wave: HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:16 @Lumexralph yo @Manish-Giri yo Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:16 @HeebieGeeBee "Not Found" @HeebieGeeBee HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:16 @SewwandiD then use that Ogundele Olumide @Lumexralph Mar 08 2017 05:16 @Manish-Giri hey bro..... how're you? better? Manish Giri @Manish-Giri Mar 08 2017 05:16 my laptop is making weird noises like it's about to catch fire or sth Ogundele Olumide @Lumexralph Mar 08 2017 05:16 @Manish-Giri :smile: like? Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:17 @HeebieGeeBee It's already there neh!! Roxroy @roxroy Mar 08 2017 05:17 @SewwandiD , try if (myObj.hasOwnProperty(checkProp)){ Manish Giri @Manish-Giri Mar 08 2017 05:17 @Lumexralph i'm feeling very sleepy these days, guessing sleep-deprivation is the new flu xD Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:18 @roxroy nope Ogundele Olumide @Lumexralph Mar 08 2017 05:18 @Manish-Giri lol, sleep bro.... it's good for your brain Manish Giri @Manish-Giri Mar 08 2017 05:19 @Lumexralph currently going through the funfunfunction vidoes he's good :sparkles: Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:19 Ogundele Olumide @Lumexralph Mar 08 2017 05:19 @Manish-Giri i don't understand, what videos, where? HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:20 @SewwandiD you have an extra curly bracket Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:20 What is this..Errrrr... @HeebieGeeBee all the braces are balanced neh??? @HeebieGeeBee where?? John B @JBIV Mar 08 2017 05:21 @SewwandiD - The curly brace where you have the red X at. Remove it. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:21 @SewwandiD not balanced its just in the wrong place Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:21 @JBIV Done.. but still Roxroy @roxroy Mar 08 2017 05:22 @SewwandiD , first remove the ==="true" and the the add one more bracket after Not found you are missing a bracket John B @JBIV Mar 08 2017 05:22 Oh whoops, @HeebieGeeBee is right. You want after the return "Not found";. Place a new } after return "not found"; Roxroy @roxroy Mar 08 2017 05:22 @SewwandiD, try to line them up and you will see John B @JBIV Mar 08 2017 05:23 If you click on one of the curly braces, it'll tell you which one it matches to. There will be a little white underline beneath the two. HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:23 if we want to delete all the redundant code just get rid of that else statement entirely and just have return not found after the if Manish Giri @Manish-Giri Mar 08 2017 05:23 @Lumexralph on youtube there's this guy it's his channel Ogundele Olumide @Lumexralph Mar 08 2017 05:24 @Manish-Giri what's the name of the channel? and what's it about? Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:24 where?? @roxroy is this what you ask me to do?? HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:25 functional programming Manish Giri @Manish-Giri Mar 08 2017 05:25 :point_up: March 8, 2017 12:19 AM @Lumexralph the name is that itself he teaches JS mostly @SewwandiD delete the } before else line 13 Ogundele Olumide @Lumexralph Mar 08 2017 05:26 interesting, i'll check it out Manish Giri @Manish-Giri Mar 08 2017 05:26 also, get in the habit of debugging your code by looking at the error messages, it will help you more as you progress in JS @SewwandiD Roxroy @roxroy Mar 08 2017 05:26 @SewwandiD , it is line 12 that need to be deleted HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:26 @SewwandiD lol im done you should be able to sort out your curlies Manish Giri @Manish-Giri Mar 08 2017 05:27 lol curlies Sewwandi Dharmapriya @SewwandiD Mar 08 2017 05:27 @Manish-Giri @roxroy @HeebieGeeBee @JBIV Okay...Finally! I'm done.. thanks alot guys!! CamperBot @camperbot Mar 08 2017 05:27 sewwandid sends brownie points to @manish-giri and @roxroy and @heebiegeebee and @jbiv :sparkles: :thumbsup: :sparkles: :warning: @jbiv's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account. :cookie: 366 | @roxroy |http://www.freecodecamp.com/roxroy :cookie: 989 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee :star2: 4645 | @manish-giri |http://www.freecodecamp.com/manish-giri Ogundele Olumide @Lumexralph Mar 08 2017 05:28 @HeebieGeeBee curlies :laughing: Roxroy @roxroy Mar 08 2017 05:28 @SewwandiD , try writing the code like this. function checkObj(checkProp) { if (myObj.hasOwnProperty(checkProp)) { return myObj[checkProp]; } else { return "Not Found"; } } It can help to spot missing braces ooops, back ticks did not work.. while showing the code Manish Giri @Manish-Giri Mar 08 2017 05:30 or, if you want return myObj.hasOwnProperty(checkProp) ? myObj[checkProp] : "Not Found"; Tom @Bort707 Mar 08 2017 05:32 var myStr = "I am a\" double quoted\" string inside\" double quotes\"";// Change this line am I still not seeing something. I know it must be a space. Ogundele Olumide @Lumexralph Mar 08 2017 05:33 @Bort707 what are you to return? Roxroy @roxroy Mar 08 2017 05:34 @Bort707 , you are missing a period at the end of the sentence. Tom @Bort707 Mar 08 2017 05:34 between the two end quotes? HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:34 var myStr = "I am a \"double quoted\" string inside \"double quotes\"." Roxroy @roxroy Mar 08 2017 05:35 @Bort707 , it is before the last " james umali @indefinite0212 Mar 08 2017 05:35 hi I need help with the challenge: Accessing Objects Properties with Variables here's my code:  (shift+enter for line break) // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumber=[16]; // Change this Line var player = testObj[playerNumber]; // Change this Line //playerNumber should be a number //Instructions / Use the playerNumber variable to lookup player 16 in testObj using bracket notation. /  Tom @Bort707 Mar 08 2017 05:36 Thank you Heebie james umali @indefinite0212 Mar 08 2017 05:36 // Setup var testObj = { 12: "Namath", 16: "Montana", 19: "Unitas" }; // Only change code below this line; var playerNumber=[16]; // Change this Line var player = testObj[playerNumber]; // Change this Line //playerNumber should be a number //Instructions /* Use the playerNumber variable to lookup player 16 in testObj using bracket notation. */ HeebieGeeBee @HeebieGeeBee Mar 08 2017 05:36 @indefinite0212 var playerNumber=16; Joseph @revisualize Mar 08 2017 05:36 @indefinite0212 playerNumber should be 16 Not an array with 16 in it. james umali @indefinite0212 Mar 08 2017 05:38 @HeebieGeeBee @revisualize thanks :) CamperBot @camperbot Mar 08 2017 05:38 indefinite0212 sends brownie points to @heebiegeebee and @revisualize :sparkles: :thumbsup: :sparkles: :cookie: 990 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee :star2: 3447 | @revisualize |http://www.freecodecamp.com/revisualize Richard Belotte @belotte Mar 08 2017 05:41 Hello there. can some one tell me why reverse() isn't working in this: function reverseString(str) { var newString = ""; var newArr = str.split(); newArr.reverse(); return newArr; } reverseString("hello"); Manish Giri @Manish-Giri Mar 08 2017 05:42 @belotte is your .split() right? Richard Belotte @belotte Mar 08 2017 05:44 I believe it is. I am getting an array but you are correct that is returning an odd array in that is returning ["hello"]. Should the quotes be there? Roxroy @roxroy Mar 08 2017 05:44 @belotte , you will need to split the letter. You forgot to pass the parameter to split, to tell it how to split the string Richard Belotte @belotte Mar 08 2017 05:45 I thought the element before the dot ("."), was what got split? No? Roxroy @roxroy Mar 08 2017 05:46 @belotte, to split the letters try split('') John B @JBIV Mar 08 2017 05:46 Make your parameter str.split(''); Otherwise it won't load the string object into a character array. Richard Belotte @belotte Mar 08 2017 05:47 OH... so even though it is not splitting at any specific character, you still need the quotes? Ogundele Olumide @Lumexralph Mar 08 2017 05:47 @belotte how do you want to split? per character? Richard Belotte @belotte Mar 08 2017 05:47 yes Manish Giri @Manish-Giri Mar 08 2017 05:47 @belotte you need to pass something to .split() directions to split John B @JBIV Mar 08 2017 05:48 @belotte - Yes. The splits tell it "split at every character". When you pass in no arguments, it doesn't know what to split so it just returns the string object. Richard Belotte @belotte Mar 08 2017 05:48 ok so a set of empty quotes with no space will split each character? John B @JBIV Mar 08 2017 05:48 Yes. Xi @yuman959 Mar 08 2017 05:48 Hi, I’m trying to print my current location’s longitude and latitude. But it doensn’t print anything. Here’s my code. navigator.geolocation.getCurrentPosition(function(position){$("#h2").html(position.coords.latitude + position.coords.longitutde); });
Richard Belotte
@belotte
Mar 08 2017 05:48
ahhh
OK
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:49
@Manish-Giri just so much i have pending to learn and what you're on seems like it's taking time or maybe it's my work that takes most of the time :worried:
Roxroy
@roxroy
Mar 08 2017 05:49
@belotte , there you go..
Manish Giri
@Manish-Giri
Mar 08 2017 05:49
@Lumexralph yep
know the feeling
Richard Belotte
@belotte
Mar 08 2017 05:50
@JBIV @Manish-Giri @Lumexralph Thank you so much! That makes sense now.
CamperBot
@camperbot
Mar 08 2017 05:50
belotte sends brownie points to @jbiv and @manish-giri and @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:50
@Manish-Giri :worried: ... what suggestion do you have for me..... i keep pushing?
CamperBot
@camperbot
Mar 08 2017 05:50
:star2: 1272 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 4646 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:50
@belotte :+1:
Manish Giri
@Manish-Giri
Mar 08 2017 05:51
@Lumexralph of course, the way I think it is - when you're drowning, you keep thrashing and pushing upwards until you reach the surface, right?
JS is the same!
John B
@JBIV
Mar 08 2017 05:51
@yuman959 - Try changing "longitutde" into "longitude". Might be a syntax error.
Manish Giri
@Manish-Giri
Mar 08 2017 05:51
or anything you're passionate about, for that matter
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:52
@Manish-Giri sighs..... working on JS and it's entities and Python...... they are kind of tearing me apart :laughing:
Joshua
@bloodymist
Mar 08 2017 05:52

Hi cant seem to get this nextInLine([5,6,7,8,9], 1) should return 5.
here's what i have
function nextInLine(arr, item) {

arr = testArr.push(item);
item = testArr.shift();

return item; // Change this line
}

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

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

Manish Giri
@Manish-Giri
Mar 08 2017 05:52
@Lumexralph python for work?
@bloodymist you need to use arr, not testArr
arr is the array passed in to your function
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:53
@Manish-Giri i told myself i'll learn it this year
@bloodymist arr not testArr
Diego Eann
@808dkaneohe
Mar 08 2017 05:53
Wait with the "stand in line" challenge are we supposed to know .shift? if so what lesson?
Manish Giri
@Manish-Giri
Mar 08 2017 05:54
@Lumexralph try out the python course from UMich on coursera
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:54
@Manish-Giri i've started though and coincidentally i need it for an interview process.....that's the language they require
@Manish-Giri is it free?
Joseph
@revisualize
Mar 08 2017 05:54
@bloodymist Why are you overwriting arr, item
Manish Giri
@Manish-Giri
Mar 08 2017 05:54
@Lumexralph yeah I remember it was free
when I took it
Joseph
@revisualize
Mar 08 2017 05:55

@808dkaneohe
Manipulate Arrays With push()

Manipulate Arrays With pop()

Manipulate Arrays With shift()

Manipulate Arrays With unshift()

Diego Eann
@808dkaneohe
Mar 08 2017 05:55
Yeah i'm confused on stand in line as well. Do we just modify testarr?
John B
@JBIV
Mar 08 2017 05:55
You can also search for Corey Schafer on YouTube. He's got some pretty good Python tutorials.
Diego Eann
@808dkaneohe
Mar 08 2017 05:55
ok thanks
Joseph
@revisualize
Mar 08 2017 05:55
@808dkaneohe No.
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:55
@Manish-Giri already working on a course from Rice University on Coursera..... maybe when am done with that
Emily Sperry
@sperrye
Mar 08 2017 05:55
$('body').on('click',function(e){ if(e.target.id !== "showForm")$('.collapse').collapse('hide');
})

I have a form in a hidden div that expands when the 'sign up' button is clicked. My goal is for that div to collapse when any other area of the page is clicked. Before I had:

$(document).on('click',function(){$('.collapse').collapse('hide');
})

But that collapsed it whenever anything was clicked, including the text inputs on the form making it impossible to fill out. How can I accomplish this?

Joseph
@revisualize
Mar 08 2017 05:56
@808dkaneohe When working with Stand In Line.. You work with the parameters that are passed into the function.
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:56
@JBIV :+1: thanks
CamperBot
@camperbot
Mar 08 2017 05:56
lumexralph sends brownie points to @jbiv :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Mar 08 2017 05:56
@808dkaneohe Some of the tests pass in testArr as an argument.
tylerccarson
@tylerccarson
Mar 08 2017 05:56
@HeebieGeeBee Thought that I fixed the scope problem but still not showing my quote
http://codepen.io/tylerccarson/pen/NdZQPz
Manish Giri
@Manish-Giri
Mar 08 2017 05:56
@Lumexralph oh, wasn't it called interactive something?
I finished parts 1and 2 of that
John B
@JBIV
Mar 08 2017 05:57
@revisualize - JavaScript works from top to bottom. You're declaring testArr at the bottom of the page. As such, JavaScript doesn't know it exists when you're trying to use the push method.
Joseph
@revisualize
Mar 08 2017 05:57
@JBIV What?
John B
@JBIV
Mar 08 2017 05:57
@revisualize - See where you say "var testArr = [1,2,3,4,5]" at the bottom of the page?
@revisualize - Oh I'm sorry! I referenced the wrong person.
Joseph
@revisualize
Mar 08 2017 05:57
@JBIV testArr is declared after the function declaration but, before the function call.
Emily Sperry
@sperrye
Mar 08 2017 05:58
Joseph
@revisualize
Mar 08 2017 05:58
@JBIV I'll say your point is still not really falling in line. Because... The variable is declared and defined before the function call.
Manish Giri
@Manish-Giri
Mar 08 2017 05:58
@Lumexralph they make you write code and submit stuff on codeskulptor right?
John B
@JBIV
Mar 08 2017 05:59
Yeah I see that now. But it's not being passed into the function like arr is. My apologies.
Joseph
@revisualize
Mar 08 2017 05:59
@JBIV It is only being passed into the function on a few tests.
Ogundele Olumide
@Lumexralph
Mar 08 2017 05:59
@Manish-Giri yeah.... exactly but submission is for paid course, if you audit the course, you won't be able to do that
Joseph
@revisualize
Mar 08 2017 05:59
Actually, just 1 test.
Richard Belotte
@belotte
Mar 08 2017 06:00

OK new question... I got this to work like this:

function reverseString(str) {
var newString = "";
var newArr = str.split('');
newArr.reverse();
var newArr2 = newArr.join('');
return newArr2;
}
reverseString("hello");

What I want to know is why do I need the "newArr2"? Why can't I do it like this:

function reverseString(str) {
var newString = "";
var newArr = str.split('');
newArr.reverse();
newArr.join('');
return newArr;
}
reverseString("hello");
Joseph
@revisualize
Mar 08 2017 06:00
@belotte because .join() actually returns something and doesn't mutate the variable.
Manish Giri
@Manish-Giri
Mar 08 2017 06:00
@Lumexralph did you actually pay for the course?
Ogundele Olumide
@Lumexralph
Mar 08 2017 06:01
@Manish-Giri nope :laughing:
Joseph
@revisualize
Mar 08 2017 06:01

@JBIV @808dkaneohe @bloodymist
Gist by revisualize / FreeCodeCamp - Stand in Line.js

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

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

function nextInLine(arr, item) { }

Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

Here's an example of this:

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

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

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

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

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

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

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

To understand what this is doing you should maybe answer this question:

function getName() { return "Happy Feet" }
var name = getName();
console.log(name);

What do you think is output to the console when you log the variable name?
Why do you think that is?

Then you go back through and figure out what you're doing and how to do it.

Manish Giri
@Manish-Giri
Mar 08 2017 06:01
@Lumexralph cool, I too didn't :smiling_imp:
still got the cert
Ogundele Olumide
@Lumexralph
Mar 08 2017 06:02
@Manish-Giri guess stuffs changed since you did yours..... right now you have to pay for the course to get your assignments graded
Manish Giri
@Manish-Giri
Mar 08 2017 06:02
@Lumexralph which course?
Richard Belotte
@belotte
Mar 08 2017 06:02
@revisualize so "split();" and "reverse();" actually mutate the original array but "join();" does not?
Joseph
@revisualize
Mar 08 2017 06:03
@sperrye Did you complete the LambdaSchool thing?
@belotte .split() doesn't mutate the variable.
Ogundele Olumide
@Lumexralph
Mar 08 2017 06:03
@Manish-Giri the interactive programming from Rice University
Joseph
@revisualize
Mar 08 2017 06:04

@belotte If you do ...

var str = "Hello";
var strArr = str.split("");
strArr.reverse();

The value of str is still "Hello"

Emily Sperry
@sperrye
Mar 08 2017 06:04
@revisualize I'm going back through it. I got sidetracked but trying to play catch up wasn't working for me. Rather than complete homework assignments I'm going to do the project (blog) straight through by following the video lessons.
Joseph
@revisualize
Mar 08 2017 06:04
@sperrye It was tough for me to follow.
Richard Belotte
@belotte
Mar 08 2017 06:04
Ahh, ok.
That's why you need the extra variables and =,
Joseph
@revisualize
Mar 08 2017 06:05
@belotte = is assignment.
Richard Belotte
@belotte
Mar 08 2017 06:05
becaus you are not actualy changing the array with the split and the join.
Emily Sperry
@sperrye
Mar 08 2017 06:06
@revisualize It was a great free course but there were errors that put me off paying for a course. Like writing the lesson in 2 after specifically requiring 3. Problems with the stream. Rambling introductions. etc.
Joseph
@revisualize
Mar 08 2017 06:06
@sperrye Yeah.
Emily Sperry
@sperrye
Mar 08 2017 06:06
I think those guys were teaching 9 hour days then trying to teach the mini camp. They looked tired.
Richard Belotte
@belotte
Mar 08 2017 06:06
I got it. NOW
Thank you
Joseph
@revisualize
Mar 08 2017 06:07
@sperrye I think I'm just going to try and download everything and do it all when I have time.
John B
@JBIV
Mar 08 2017 06:07
@revisualize @sperrye - Same for me with LambdaSchool. Other coursework and FCC has been eating up too much time to work on the LS assignments.
Emily Sperry
@sperrye
Mar 08 2017 06:09
@JBIV I've shifted my focus to projects. After going through all the JS stuff here, while I learned a ton, I don't have anything to show for it. I need complete examples.
devpaaji
@devpaaji
Mar 08 2017 06:09
@sperrye what course have you done
I PM you
Emily Sperry
@sperrye
Mar 08 2017 06:10
I should go back and do the projects like the calculator
@devpaaji just a free course from lambdaschool on python/flask.
devpaaji
@devpaaji
Mar 08 2017 06:11
check the message I sent you
Joseph
@revisualize
Mar 08 2017 06:12
@devpaaji Lambdaschool mini-bootcamp
@sperrye I dislike it when people PM me. I don't respond to them.
Manish Giri
@Manish-Giri
Mar 08 2017 06:13

@sperrye

I've shifted my focus to projects. After going through all the JS stuff here, while I learned a ton, I don't have anything to show for it

what about the projects here on fcc?
Emily Sperry
@sperrye
Mar 08 2017 06:13
@devpaaji if you want to help, you can help me figure out how to make this http://www.bootply.com/J5jNwPoWyS# form collapse only when clicking on the page outside of the target div
devpaaji
@devpaaji
Mar 08 2017 06:14
@revisualize how was the exp
of the bootcamp
Joseph
@revisualize
Mar 08 2017 06:14
@devpaaji I haven't completed it. It felt like this was a beta-test for a small free bootcamp that they want to do.
Emily Sperry
@sperrye
Mar 08 2017 06:15
@Manish-Giri Yeah, after that I said I need to go back and work on those. I think I'll build them with atom then import them to codepen, though. I kind of dislike codepen.
Joseph
@revisualize
Mar 08 2017 06:15
@devpaaji It felt like there was stuff just missing. And they had to make a few extra videos to fill gaps of things that they missed.
@devpaaji Also, like @sperrye said, there was some stuff that felt like they was too much chatter and just not getting to the damn point.
devpaaji
@devpaaji
Mar 08 2017 06:16
most camps are rushing and dont teach fundamentals
in fact they hire developers who have recently started
training is different from teaching
Joseph
@revisualize
Mar 08 2017 06:16
@devpaaji But, there were times when they would just babble about what felt like useless stuff... Then RUSH!
devpaaji
@devpaaji
Mar 08 2017 06:16
not many know the art
and cant be done in 12 weeks
I do not understand how people are learning Bootstrap and Jquery without learning CSS
and JS
Joseph
@revisualize
Mar 08 2017 06:17
@devpaaji But, I haven't completed the thing yet.
devpaaji
@devpaaji
Mar 08 2017 06:17
and keep track of it
Joseph
@revisualize
Mar 08 2017 06:18
So.. my opinion may be not complete.
@devpaaji I got shit to do.
@devpaaji I have 4 Pluralsight courses to do. I want to finish my last two intermed algo challenges.
devpaaji
@devpaaji
Mar 08 2017 06:20
good
keep up good work
Joseph
@revisualize
Mar 08 2017 06:20
At some point, I really want to do CS50 again.
devpaaji
@devpaaji
Mar 08 2017 06:20
what are you learning
JS or back end
@sperrye let me check the link
Joseph
@revisualize
Mar 08 2017 06:20
I'm a Network Systems Administrator III
devpaaji
@devpaaji
Mar 08 2017 06:21
and update
Joseph
@revisualize
Mar 08 2017 06:21
I have to take a course on SCCM and SCVMM.
I also want to learn Project Management as a career growth goal.
Joseph
@revisualize
Mar 08 2017 06:28
@devpaaji I have a bunch of Pluralsight courses to do.
Administering System Center Configuration Manager (SCCM)
Installing System Center 2012 Operations Manager
System Center 2012 Operations Manager: Configuring and Managing
Planning & Creating Applications in System Center ConfigMgr 2012
... That's just work stuff.
Then personally I want to do:
Learning To Program - Being A Better Programmer
Algorithms and Data Structures - Part 1
Algorithms and Data Structures - Part 2
Becoming an Outlier: Reprogramming the Developer Mind
...
But, as a goal. I also need to learn about Project Management.
I also want to take time to actually learn about DevOps. System Automation, Docker, AWS, Continuous Integration and Continuous Delivery. Not to mention, I want to learn more about Network Security for my job role too.
Hashtag-Goals and hustle and shit
John B
@JBIV
Mar 08 2017 06:30
@revisualize - Are you familiar with Cybrary?
Joseph
@revisualize
Mar 08 2017 06:31
@JBIV I am.
John B
@JBIV
Mar 08 2017 06:31
Haha I was about to recommend that for some stuff. Although I would entirely skip the CompTIA stuff. Anything besides Security+ is garbage and Security+ is only good if you're trying to get a position at the DoD.
Linux+ was okay though, I guess.
Prashant Acharya
@Prashant-Acharya
Mar 08 2017 06:32
Hey everyone. Can anyone help me to complete sum all odd fibonacci numbers?
Markus Kiili
@Masd925
Mar 08 2017 06:32
@Prashant-Acharya Sure.
Joseph
@revisualize
Mar 08 2017 06:33
@JBIV Honestly, the CompTIA Certs are actually worth it.
Prashant Acharya
@Prashant-Acharya
Mar 08 2017 06:33
function sumFibs(num) {
var a = 1;
var b = 1;
var sum = 0;
for (var i = 0 ; ; i++){
if (a > num || b > num)
break;
if (a <= num && a % 2 == 1)
sum = sum + a;
if (b <= num && b % 2 == 1)
sum = sum + b;

var sth = a + b;
a = b;
b = sth;
}
return sum;
}
Joseph
@revisualize
Mar 08 2017 06:34
@JBIV I do recommend that someone looks at getting them depending on what industry they're going into.
@JBIV But, they are in NO way an end goal.
John B
@JBIV
Mar 08 2017 06:35
Oh I know. CCNA or MCSA are the next level after the CompTIA stuff. And then from there CCNP, CCIE, MCSE, etc.
Markus Kiili
@Masd925
Mar 08 2017 06:36
@Prashant-Acharya Are a and b the first two Fibos?
055IRI5
@055IRI5
Mar 08 2017 06:36
hey guys am stuck on "Comparisons with the Logical Or Operator" does anyone know how to do this
Prashant Acharya
@Prashant-Acharya
Mar 08 2017 06:36
yes ??
function sumFibs(num) {
var a = 1;
var b = 1;
var sum = 0;
for (var i = 0 ; ; i++){
if (a <= num && a % 2 == 1 && a < num)
sum = sum + a;
else if (a > num){
break;
}

if (b <= num && b % 2 == 1)
sum = sum + b;
else if (b > num){
break;
}

var sth = a + b;
a = b;
b = sth;
}
return sum;
}
Markus Kiili
@Masd925
Mar 08 2017 06:37
@Prashant-Acharya It is easier if you initialize sum to 2 and use condition a+b<=num on the for loop.
@Prashant-Acharya Then just calculate the next fibo, check it, change sum if needed, and do the switch.
james umali
@indefinite0212
Mar 08 2017 06:47
anyone know how to make personal portfolio webpage look goo in different screen?
Markus Kiili
@Masd925
Mar 08 2017 06:48
@indefinite0212 You mean on different screen sizes?
james umali
@indefinite0212
Mar 08 2017 06:48
@Masd925 yes
Markus Kiili
@Masd925
Mar 08 2017 06:49
@indefinite0212 You can use CSS media queries, or a grid system like the one Bootstrap framework has.
james umali
@indefinite0212
Mar 08 2017 06:50
@Masd925 how?
Markus Kiili
@Masd925
Mar 08 2017 06:51
@indefinite0212 Easiest way is to learn to use Bootstrap. Find some tutorial about it.
@heyDante
Mar 08 2017 06:57
@indefinite0212 You could give flexbox a try too
abdi rahman
@abdiezy
Mar 08 2017 07:01
it works on codepen but it doesn't work on my laptop any tips
function getData(){

\$.ajax({
dataType:"json",
url:"http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=10",
type:"GET",
success:successFn,
error:errorFn,
complete: function(xhr,status){
console.log("the data is complete");
}
})
}

function successFn(){
console.log('json');
}

function errorFn(){
console.log("it didnt work!!");
}
Mar 08 2017 07:01
Hey guys

What am i doing wrong here function nextInLine(arr, item) {

return arr.shift(item); // Change this line
}

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

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

This is from challenge 173
Markus Kiili
@Masd925
Mar 08 2017 07:04
@ArhaanAhmad First you need to add the element. Shift is not the method for that.
Mar 08 2017 07:06
okay
Markus Kiili
@Masd925
Mar 08 2017 07:06
That is fine for the second line if you remove the argument.
abdi rahman
@abdiezy
Mar 08 2017 07:07
Mar 08 2017 07:07
No Indian
abdi rahman
@abdiezy
Mar 08 2017 07:08
@Masd925 any tips on the ajax thing?
Richard Belotte
@belotte
Mar 08 2017 07:11
can some one explain literal vs constructor notation for regex patterns?
Michaël Nde T.
@nt-michael
Mar 08 2017 07:13
Good mornin guys
am getting a weird kind of bug
AKS
@amitkumarsarangi
Mar 08 2017 07:13
how to insert code in chat??? can some one help???
Markus Kiili
@Masd925
Mar 08 2017 07:14
@abdiezy Any errors on developer tools console?
Mar 08 2017 07:14
'code'
is fun
Michaël Nde T.
@nt-michael
Mar 08 2017 07:14
example.push()
push is not a function
Markus Kiili
@Masd925
Mar 08 2017 07:16
@nt-michael You most likely have changed example into something that is not an array.
Michaël Nde T.
@nt-michael
Mar 08 2017 07:16
actually this is my code

function repeatStringNumTimes(str, num) {
// repeat after me
if(num > 0){
var repeat = [];
for (var i = 1; i <= num; i++){
repeat = repeat.push(str);
}
repeat = repeat.join("");
return repeat;
}
return "";
}

repeatStringNumTimes("abc", 3);
according to my theory it looks gud
Markus Kiili
@Masd925
Mar 08 2017 07:17
@nt-michael What is the return value of push method? repeat = repeat.push(str);
AKS
@amitkumarsarangi
Mar 08 2017 07:17
@kirbyedy thanks
CamperBot
@camperbot
Mar 08 2017 07:17
amitkumarsarangi sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1899 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
Michaël Nde T.
@nt-michael
Mar 08 2017 07:17
@Masd925 it's still an array
abdi rahman
@abdiezy
Mar 08 2017 07:18
@Masd925 nop
@Masd925 but it fires the error function
Michaël Nde T.
@nt-michael
Mar 08 2017 07:19
@Masd925 it returns a value to the end of repeat array which i got initialized earlier
Markus Kiili
@Masd925
Mar 08 2017 07:19
@nt-michael Not an array after repeat = repeat.push(str);
Push returns the new length of the array.
Just do repeat.push(str);
Michaël Nde T.
@nt-michael
Mar 08 2017 07:20
ok
Markus Kiili
@Masd925
Mar 08 2017 07:20
@nt-michael Most mutator methods return something else than the mutated array.
Dan Couper
@DanCouper
Mar 08 2017 07:22
@belotte new String() constructs a string according to the arguments passed, literal uses " or '. new Array() constructs an array according to the arts passed, literal uses []. new Object() constructs an object according to the arts passed, literal uses {}. new Regexp() constructs a regex using whatever arguments you pass, literal uses //. Of those, regex is the only one that should really be used (bar occasionaly Array), sometimes want to build regexes on the fly using variables, which is easier to do by passing in a string to a constructor function. 99.9% of the time, you'll use literal
*arguments, not arts
Michaël Nde T.
@nt-michael
Mar 08 2017 07:23
function repeatStringNumTimes(str, num) {
// repeat after me
if(num > 0){
var repeat = [];
for (var i = 1; i <= num; i++){
repeat.push(str);
}
repeat = repeat.join("");
return repeat;
}
return "";
}

repeatStringNumTimes("abc", 3);
thanks @Masd925 it works :)
CamperBot
@camperbot
Mar 08 2017 07:23
:star2: 3538 | @masd925 |http://www.freecodecamp.com/masd925
nt-michael sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
AKS
@amitkumarsarangi
Mar 08 2017 07:24

I am expecting the return result to be [3, 5, 4] but it is giving [3, 5, 2, 1, 4]

function sym(args) {
var temp0 = [], temp1 = [], tempArr = [];
for (var i=0; i<arguments.length; i++) {
temp0 = arguments[i];
temp1 = arguments[i+1];

if (Array.isArray(arguments[i+1])) {
for (var j2=0; j2<arguments[i+1].length; j2++) {
if (arguments[i].indexOf(arguments[i+1][j2])>-1) {
temp0.splice(arguments[i].indexOf(arguments[i+1][j2]), 1);
}
}tempArr = tempArr.concat(temp0);}

if (Array.isArray(arguments[i])) {
for (var j1=0; j1<arguments[i].length; j1++) {
if (arguments[i+1].indexOf(arguments[i][j1])>-1) {
temp1.splice(arguments[i+1].indexOf(arguments[i][j1]), 1);
}
}tempArr = tempArr.concat(temp1);}

return tempArr;
}
}

sym([1, 2, 3], [5, 2, 1, 4]);

Can someone please figure why is it so??? I am not able to figure out why???

Richard Belotte
@belotte
Mar 08 2017 07:25
so is there a way to match more than one pattern using regex? @DanCouper
Dan Couper
@DanCouper
Mar 08 2017 07:26
need to explain what you're trying to do
Sewwandi Dharmapriya
@SewwandiD
Mar 08 2017 07:26
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line

var gloveBoxContents = myStorage.car.inside;
Hi, this doesn't show the relevant properties..why is that?
Can sombody kindly explain...
Johnny
@jtan3
Mar 08 2017 07:32
@SewwandiD there's 2 objects inside how would you get glove box?
Sewwandi Dharmapriya
@SewwandiD
Mar 08 2017 07:34
@jtan3..I forgot to add ["glove box"] at the end..Btw.. thanks ! :)
CamperBot
@camperbot
Mar 08 2017 07:34
sewwandid sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
AKS
@amitkumarsarangi
Mar 08 2017 07:35
@SewwandiD you need to go into "inside" as well
@SewwandiD
Tricia
@patricia07
Mar 08 2017 07:35
hey guys
AKS
@amitkumarsarangi
Mar 08 2017 07:36

@SewwandiD

gloveBoxContents = myStorage.car.inside["glove box"];

Tricia
@patricia07
Mar 08 2017 07:36
i can't move on
can u helpy me guys
John B
@JBIV
Mar 08 2017 07:36
@patricia07 - What do you need help with?
Tricia
@patricia07
Mar 08 2017 07:36
escape sequences in strings
i have like no idea on how to this
Sewwandi Dharmapriya
@SewwandiD
Mar 08 2017 07:38
@amitkumarsarangi Thank you so much!!