These are chat archives for FreeCodeCamp/HelpJavaScript

14th
May 2017
FlashHero
@FlashHero
May 14 2017 00:00
@sjames1958gm thanks i understood the second one and passed the challenge
CamperBot
@camperbot
May 14 2017 00:00
flashhero sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7298 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
aRtoo
@artoodeeto
May 14 2017 00:02

hi guys solved the 1st algorithm prob heres the code but i was disappointed.


function reverseString(str) {

  var test = str.split("");
      //console.log(test);

     var reversedWord = test.reverse();
     //console.log(reversedWord);

      var joinWord = reversedWord.join('');

  return joinWord;
}

reverseString("hello");

because theres an easy why to solve it. i thought i was getting it but im not! FML!!! heres the easy way.

function reverseString(str) {


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

}

reverseString("hello");
Stephen James
@sjames1958gm
May 14 2017 00:06
@artoodeeto
Its call function chaining. You can call a function on the return value of a function directly.
so str.split("") returns an array which you .reverse() which returns an array which you .join("") which
returns a string which is the value returned from the function
Unless you weren't asking, just commenting
Moisés Man
@moigithub
May 14 2017 00:08
@artoodeeto if u know whats the input and output of functions (result) u can method chain like that
Aizaz Shahid
@aizazshahid
May 14 2017 00:13
@artoodeeto don't disappointed, feel happy, because you solved it at least :exclamation:
Pagnito
@Pagnito
May 14 2017 00:16
hey need some help
Stratos Iordanidis
@iamstratos
May 14 2017 00:18
@Pagnito help? whats the problem?
Pagnito
@Pagnito
May 14 2017 00:21
@ssstratos I'm trying to use a single button to type in parenthesis into the calculator, I'm using a regex to say if there is /((.+/ then append ) and if there is /((.+)/ then append ( and that works so far, but then i can't append ) again because the second regex will always pass
Stratos Iordanidis
@iamstratos
May 14 2017 00:23
@Pagnito can you send your code maybe on a codepen?
Pagnito
@Pagnito
May 14 2017 00:23
k
the function I'm talking about is at line 13
dinosaurjude
@dinosaurjude
May 14 2017 00:28

anyone know whats wrong with this?
var Bike = function() {
var gear =0;

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

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

nvm i got it lol
Aizaz Shahid
@aizazshahid
May 14 2017 00:33
@dinosaurjude In this.setGear, you should assign the change value to gear but you are incrementing it and also wrong !
Bryan Reese
@breese8009
May 14 2017 00:33
@dinosaurjude gear should be global var
dinosaurjude
@dinosaurjude
May 14 2017 00:33
thanks @forwebtech and @breese8009
CamperBot
@camperbot
May 14 2017 00:33
dinosaurjude sends brownie points to @forwebtech and @breese8009 :sparkles: :thumbsup: :sparkles:
:cookie: 598 | @breese8009 |http://www.freecodecamp.com/breese8009
:cookie: 519 | @forwebtech |http://www.freecodecamp.com/forwebtech
Bryan Reese
@breese8009
May 14 2017 00:34
@forwebtech actually set gear looks right to me?
Aizaz Shahid
@aizazshahid
May 14 2017 00:34
no, its wrong !
@breese8009 that is a setter, which set the value of private variable gear
Nils Röhrig
@drunknzombiecow
May 14 2017 00:35
@breese8009 don't think so, because it's a property the new Bike object. If gear is global, than every instance of a bike would share the same variable.
Anurag Lahon
@anuraglahon16
May 14 2017 00:39
Finish writing this function so that it returns true only if the users object contains all four names, Alan, Jeff, Sarah, and Ryan, as keys, and false otherwise.
Turbokretzsche
@Turbokretzsche
May 14 2017 00:39
shouldn't it be this.gear in that case?
Aizaz Shahid
@aizazshahid
May 14 2017 00:41
@Turbokretzsche if this used, then it will become global !
Turbokretzsche
@Turbokretzsche
May 14 2017 00:42
ok global but also specific to the object or do i misunderstand this?
Pagnito
@Pagnito
May 14 2017 00:42
@forwebtech can u explain to me this.setGear i never seen this
Bryan Reese
@breese8009
May 14 2017 00:42
@drunknzombiecow @forwebtech my bad, i was lookin at get gear while tlaking about set gear.
Aizaz Shahid
@aizazshahid
May 14 2017 00:42
@Turbokretzsche yes specific to that object !
@Pagnito actually we make methods to access the private variables. so we called them setter / getter
Pagnito
@Pagnito
May 14 2017 00:43
oooh
Aizaz Shahid
@aizazshahid
May 14 2017 00:43
.setGear is used to assign the new value to the private variable gear
it is a best example of encapsulation.
Pagnito
@Pagnito
May 14 2017 00:44
isn't just erasing with gear = reassign it tho?
reasoning*
reassigning
damn auto correct
Aizaz Shahid
@aizazshahid
May 14 2017 00:45
@Pagnito gear is private to that object, so can't be access directly !
Nils Röhrig
@drunknzombiecow
May 14 2017 00:45
@breese8009 no worries! :)
Pagnito
@Pagnito
May 14 2017 00:46
@forwebtech but he is doing it withing the function that he defined gear
Aizaz Shahid
@aizazshahid
May 14 2017 00:47
@Pagnito indeed, but the methods .setGear and .getGear is used for outside
Pagnito
@Pagnito
May 14 2017 00:47
oooooooooooh
aRtoo
@artoodeeto
May 14 2017 00:47
@forwebtech @moigithub @sjames1958gm thanks man. i just thought i solved it. ;(
CamperBot
@camperbot
May 14 2017 00:47
artoodeeto sends brownie points to @forwebtech and @moigithub and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 520 | @forwebtech |http://www.freecodecamp.com/forwebtech
:star2: 3217 | @moigithub |http://www.freecodecamp.com/moigithub
:star2: 7299 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Pagnito
@Pagnito
May 14 2017 00:47
o @forwebtech thanks
CamperBot
@camperbot
May 14 2017 00:47
pagnito sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 521 | @forwebtech |http://www.freecodecamp.com/forwebtech
Anurag Lahon
@anuraglahon16
May 14 2017 00:47

let users = {
Alan: {
age: 27,
online: true
},
Jeff: {
age: 32,
online: true
},
Sarah: {
age: 48,
online: true
},
Ryan: {
age: 19,
online: true
}
};

function isEveryoneHere(obj) {
// change code below this line
users.hasOwnProperty('Alan');
users.hasOwnProperty('Jeff');
users.hasOwnProperty('Sarah');
users.hasOwnProperty('Ryan');
}
console.log(isEveryoneHere(users));

What's wrong in my code
Aizaz Shahid
@aizazshahid
May 14 2017 00:48
why did you make your function static ??
if you have to check manually by typing the values to .hasOwnProperty() then there is no use of that function. So, use that obj parameter to check the property !
@anuraglahon16 is the names are static ? means can't be change ?
Stratos Iordanidis
@iamstratos
May 14 2017 00:53
@Pagnito why are you using .test method?
Aizaz Shahid
@aizazshahid
May 14 2017 00:54
you need to pass also the names into the arguments, like:
isEveryoneHere( users,  [ 'Alan', ..... ] );
Moisés Man
@moigithub
May 14 2017 00:54
@anuraglahon16 hasOwnProperty method return a boolean value... true or false
u not doing anything with that
most probably u will need to use an IF condition to check
Pagnito
@Pagnito
May 14 2017 00:54
@ssstratos to test for is there is (8 then append )
@ssstratos and if (8) then ( again
@ssstratos but the second regex will keep passin aftrr that if i eant another set of paranthesis
Stratos Iordanidis
@iamstratos
May 14 2017 00:57
@Pagnito yeah, let me see
Pagnito
@Pagnito
May 14 2017 00:59
@ssstratos k brb in like 10 min...just let me know wity the mentio and ill see it once back
Anurag Lahon
@anuraglahon16
May 14 2017 01:02
@forwebtech how can we solve this problem
Finish writing this function so that it returns true only if the users object contains all four names, Alan, Jeff, Sarah, and Ryan, as keys, and false otherwise. @forwebtech
Stephen James
@sjames1958gm
May 14 2017 01:04
@anuraglahon16 You can use return users.hasOwnProperty("Alan") && . . .
it will only return true if all 4 are true
Anurag Lahon
@anuraglahon16
May 14 2017 01:05
user.hasOwnProperty("Alan")&("Jeff")?? @sjames1958gm
Stephen James
@sjames1958gm
May 14 2017 01:06
@anuraglahon16 No return users.hasOwnProperty("Alan") && users.hasOwnProperty("Jeff") && the rest
Aizaz Shahid
@aizazshahid
May 14 2017 01:06
@anuraglahon16 but if you need to use obj as obj.hasOwnProperty()
because that is your parameter for that object
Stephen James
@sjames1958gm
May 14 2017 01:06
Yes, use the object passed to the function.
Aizaz Shahid
@aizazshahid
May 14 2017 01:06
@anuraglahon16 you can use && operator which ensures all conditions should be true as @sjames1958gm told
if ( ... &&  ... && ... ) {
   return true;
}
Stephen James
@sjames1958gm
May 14 2017 01:07
Or just return the condition without the if
Anurag Lahon
@anuraglahon16
May 14 2017 01:08

function isEveryoneHere(obj) {
// change code below this line
return obj.hasOwnProperty('Alan')&&('Jeff')&&('Sarah')&&('Ryann');

}

Stephen James
@sjames1958gm
May 14 2017 01:08
@anuraglahon16 no you have to call obj.hasOwnProperty 4 times
Aizaz Shahid
@aizazshahid
May 14 2017 01:09
@anuraglahon16 it is a challenge or doing yourself ?
Anurag Lahon
@anuraglahon16
May 14 2017 01:09
ok @sjames1958gm s
Jianhao Tan
@jaanhio
May 14 2017 01:12
var flattenedArr=[].concat(...arr);
  return flattenedArr.some(Array.isArray)? steamrollArray(flattenedArr):flattenedArr;
may i know what is the name of ? a:b method?
where can i read more on it
Aizaz Shahid
@aizazshahid
May 14 2017 01:13
if making by self, so in that case, make another parameter named, keys and pass all names as arguments into a array as i told above, and then into your method use for... of loop which will iterate through all names, and make sure if any value hasn't found return false and after the loop returns true.
Manish Giri
@Manish-Giri
May 14 2017 01:13
@jaanhio it's a ternary operator
Jianhao Tan
@jaanhio
May 14 2017 01:14
@forwebtech @Manish-Giri ah thank you both! was thinking so hard to recall what it is
CamperBot
@camperbot
May 14 2017 01:14
jaanhio sends brownie points to @forwebtech and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 522 | @forwebtech |http://www.freecodecamp.com/forwebtech
:star2: 5492 | @manish-giri |http://www.freecodecamp.com/manish-giri
Stratos Iordanidis
@iamstratos
May 14 2017 01:14
@Pagnito I have a solution
@Pagnito Talk to me when you are back
Pagnito
@Pagnito
May 14 2017 01:19
@ssstratos im back. give me some hinta
hints
Stratos Iordanidis
@iamstratos
May 14 2017 01:21
@Pagnito lets remove .test if possible and use indexOf
@Pagnito like text.indexOf(')');
that's first step
Pagnito
@Pagnito
May 14 2017 01:22
hmm ik hold on
Garo
@Garabed96
May 14 2017 01:23
https://codepen.io/CapGaro/pen/aWVZyJ
am I doing something wrong here, why are the url's taking so long to god damn load
I feel like twitch is slow af
TayCodes
@TayCodes
May 14 2017 01:27
https://codepen.io/dev999/pen/YVLgdq Hello does anyone know why to access the key and properties in my foo object in need to write var b = "a" to assign a new value and var b = foo["a"]; returns undefined? Thanks!
Manish Giri
@Manish-Giri
May 14 2017 01:28

what?

can you specify?

Stephen James
@sjames1958gm
May 14 2017 01:29
@TayCodes var b = foo["a"] results in b == "hello world"
foo[b] is then foo["hello world"] is undefined
Pagnito
@Pagnito
May 14 2017 01:29

@ssstratos

if(text.indexOf('(')<0){
      $('.equation').append('(');
    } else if(text.indexOf('(')>0){

     $('.equation').append(')');

    }

but doesnt seem to append after first one

Stratos Iordanidis
@iamstratos
May 14 2017 01:31
@Pagnito even if you append the first one, indexOf will return only -1 (not found) or 0 (found) so you have the same problem as before
Pagnito
@Pagnito
May 14 2017 01:31
yea, it prints () and then) over and over, hold on tho
TayCodes
@TayCodes
May 14 2017 01:32
@sjames1958gm so if you have several variables a it won't work? Because then why do I need to write document.write(obj[b]); and not just b to access it?
Stephen James
@sjames1958gm
May 14 2017 01:33
@TayCodes Do you mean properties? (a is a property not a varaiable)
TayCodes
@TayCodes
May 14 2017 01:33
@sjames1958gm apparently I can access a and b without any reference to the object
Stephen James
@sjames1958gm
May 14 2017 01:33
You could use Object.keys(foo) to get an array of properties
Gulsvi
@gulsvi
May 14 2017 01:36
@Garabed96 It's a known issue - twitch doesn't let you open channels from inside an iframe, like the one we use for development in codepen.
Peter Barnett
@csgosmorf
May 14 2017 01:39
Would someone be willing to enter a private chat so I can get help with debugging an array-splicing issue?
TayCodes
@TayCodes
May 14 2017 01:44
@csgosmorf https://www.freecodecamp.com/csgosmorf tells me youve done 130 lessons in two days thats way too fast you need to review and splice is a pain and way too complicated after two days of JS. (1 index of stuff u want added or del, 0 the amount, "blah" "blah" items u want added);
@csgosmorf also u did jquery before js basics which is terribad but the curriculums fault
Pagnito
@Pagnito
May 14 2017 01:45
@ssstratos thanks
CamperBot
@camperbot
May 14 2017 01:45
pagnito sends brownie points to @ssstratos :sparkles: :thumbsup: :sparkles:
:cookie: 198 | @ssstratos |http://www.freecodecamp.com/ssstratos
Jose Antonio Rivas
@joseantonio
May 14 2017 01:45
hi guys
Stratos Iordanidis
@iamstratos
May 14 2017 01:45
@Pagnito good luck
Pagnito
@Pagnito
May 14 2017 01:45
@ssstratos u too thanks
CamperBot
@camperbot
May 14 2017 01:45
pagnito sends brownie points to @ssstratos :sparkles: :thumbsup: :sparkles:
:warning: pagnito already gave ssstratos points
Carson Hanel
@chingy1510
May 14 2017 01:46
Question to anyone that has done "Falsy Bouncer"
My code returns all of the right values, but is not being accepted.
Any insight?
Stratos Iordanidis
@iamstratos
May 14 2017 01:46
@joseantonio hey
Moisés Man
@moigithub
May 14 2017 01:46
@chingy1510 show what code u did .. easier to check
Carson Hanel
@chingy1510
May 14 2017 01:46
Kk.

function bouncer(arr) {
if(!undefined){
return arr;
}
else{
return;
}
}

bouncer([7, "ate", "", false, 9]).filter(bouncer);

Sorry to muddy up the chat, folks.
taking out the initial call of bouncer() around the array also works.
Peter Barnett
@csgosmorf
May 14 2017 01:47
@TayCodes That was with HTML, CSS, JQuery. I had taken HTML and CSS before ever using freecodecamp, which is why I sped through a lot of those lessons, and I put in a bunch of hours into javascript outside of codecamp.
Moisés Man
@moigithub
May 14 2017 01:48
@chingy1510 all ur code should be inside bouncer function (ie. filter)
TayCodes
@TayCodes
May 14 2017 01:48
@csgosmorf you're welcome for the explanation good night.
ArchivalBoat50
@ArchivalBoat50
May 14 2017 01:48
'''
CamperBot
@camperbot
May 14 2017 01:48
:bulb: to format code use backticks! ``` more info
Carson Hanel
@chingy1510
May 14 2017 01:48
@moigithub if I do, it tells me the filter is not a function.
ArchivalBoat50
@ArchivalBoat50
May 14 2017 01:49
function reverseString(str) {
  return str.split("").join("").reverse("");
}

reverseString("hello");
can someone please tell me what im doing wrong?
Moisés Man
@moigithub
May 14 2017 01:49
filter is an array method.. so check what u applying to @chingy1510
ArchivalBoat50
@ArchivalBoat50
May 14 2017 01:49
im trying to reverse the string
Moisés Man
@moigithub
May 14 2017 01:50
@ArchivalBoat50 reverse is an Array method...
check what values those methods returns (split, join, reverse )
u can use mdn.io to check documentation
ie. mdn.io/join
Carson Hanel
@chingy1510
May 14 2017 01:50
Ah, may be the fact that var temp = arr.filter().... Temp isn't initialized as an array yet. grumble grumble c++ xD
Thank you @moigithub
CamperBot
@camperbot
May 14 2017 01:51
chingy1510 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3218 | @moigithub |http://www.freecodecamp.com/moigithub
Jacob Pieczynski
@jakepie123
May 14 2017 01:52

What does it mean by "Function Expected"? I am on algorithm challenge: Confirm the Ending. Here is my code:
function confirmEnding(str, target) {
var check = target;
var word = str;
word.split("");
check.split("");
for (var i = 0; i < str.length(); i++) {
if (word[i] === check) {
return true;
}
else {
return false;
}
}
}

confirmEnding("Bastian", "n");

Carson Hanel
@chingy1510
May 14 2017 01:53
Hm.
ArchivalBoat50
@ArchivalBoat50
May 14 2017 01:53
@moigithub Oh I see now, thx
CamperBot
@camperbot
May 14 2017 01:53
archivalboat50 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3219 | @moigithub |http://www.freecodecamp.com/moigithub
Carson Hanel
@chingy1510
May 14 2017 01:54
@jakepie123 when I solved the algorithm, what I did was split the words based on characters, and compared the last x values to the first x values of the test word
Moisés Man
@moigithub
May 14 2017 01:54
@jakepie123 length is a property (not a method,, only methods/functions use () at the end)
Carson Hanel
@chingy1510
May 14 2017 01:54
Mmm. Yeah, moigit is right.
The change was weird for me too.
Jacob Pieczynski
@jakepie123
May 14 2017 01:54
@moigithub Thanks
CamperBot
@camperbot
May 14 2017 01:54
jakepie123 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3220 | @moigithub |http://www.freecodecamp.com/moigithub
Jacob Pieczynski
@jakepie123
May 14 2017 01:55
@chingy1510 So, what else should I do?
Stratos Iordanidis
@iamstratos
May 14 2017 01:55
anyone good with canvas?
Carson Hanel
@chingy1510
May 14 2017 01:55
If I remember correctly, I used a nested for-loop
Basically if any character doesn't match, return false
If the loop is able to fulfill itself with no false return, return true.
Moisés Man
@moigithub
May 14 2017 01:56
@jakepie123 u can use substr, substring or slice to "extract" part of str and compare vs target
another way is using a loop/some extra variable
or regex
Coldtrane
@Coldtrane
May 14 2017 01:56
can someone please give an example of how to assign a js variable to another?
Carson Hanel
@chingy1510
May 14 2017 01:56
You're doing it correctly splitting by ("")
Manish Giri
@Manish-Giri
May 14 2017 01:56
@Coldtrane var x = 10; var y = x;
Carson Hanel
@chingy1510
May 14 2017 01:56
Because now you've two arrays of characters to compare.
Just apply it like you would any other language.
Coldtrane
@Coldtrane
May 14 2017 01:56
@Manish-Giri Thanks!
CamperBot
@camperbot
May 14 2017 01:56
coldtrane sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5493 | @manish-giri |http://www.freecodecamp.com/manish-giri
Jacob Pieczynski
@jakepie123
May 14 2017 01:57
@moigithub I wanted to try the challenge on my own without looking at the links, but since mine isn't working, I will look at it. Would you recommend W3C or MDN?
Carson Hanel
@chingy1510
May 14 2017 01:57
@jakepie123 I can show you my nested for-loop to get you started.
Jacob Pieczynski
@jakepie123
May 14 2017 01:57
@chingy1510 Ok, thanks
CamperBot
@camperbot
May 14 2017 01:57
jakepie123 sends brownie points to @chingy1510 :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @chingy1510 |http://www.freecodecamp.com/chingy1510
Carson Hanel
@chingy1510
May 14 2017 01:58
for(var i = limit; i < tempS.length; i++){
if(tempS[i] == tempT[count]){
test = true;
}
else{
return false;
}
count++;
}
Moisés Man
@moigithub
May 14 2017 01:58
w3school is easier to beginners (but outdated)
mdn is more technical (probably harder to understand) @jakepie123
soo check both :)
Carson Hanel
@chingy1510
May 14 2017 01:58
With that, I kept track of the two words in separate variables
and count is just a counter variable to be able to start from the beginning of the test word, rather than having to use some weird modulus operation.
I'm sure it's not the most eloquent solution, but it works.
limit is the difference in size between the full array and test word.
Jacob Pieczynski
@jakepie123
May 14 2017 01:59
@moigithub I think W3School is much easier to read, so should I use that over MDN?
Moisés Man
@moigithub
May 14 2017 02:00
i use to check both.. for basic stuff w3s is enough (i think) @jakepie123
Jacob Pieczynski
@jakepie123
May 14 2017 02:01
@moigithub Thanks
CamperBot
@camperbot
May 14 2017 02:01
jakepie123 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:warning: jakepie123 already gave moigithub points
Jacob Pieczynski
@jakepie123
May 14 2017 02:01
@moigithub Just finished reading on .substr and .substring Way confused now, lol. What should I do?
张彬
@supermanzhangbin
May 14 2017 02:06
.
Jacob Pieczynski
@jakepie123
May 14 2017 02:09

I am working on the Confirm the Ending algorithm challenge, and I almost have all of the criteria completed. What should I do to fix it?
function confirmEnding(str, target) {
var word = str;
var last = target;
var i = word.length - 1;
if (word.substr(i) === last) {
return true;
}
if (word.substr(i) !== last) {
return false;
}
}

confirmEnding("Bastian", "n");

Riccardo
@RiccardoSH
May 14 2017 02:14

Hi all! One question about the Freecode Camp chalange Testing Objects for Properties - Basic Javascript. This is my code:
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

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

}

// Test your code by modifying these values
checkObj("bed");

If the property is found, return that property's value. If not, return "Not Found".
But when I run it, it returns the property's name, in this case it returns 'bed' and not its value 'sleigh'. What am I doing wrong? Thanks

FlashHero
@FlashHero
May 14 2017 02:16
@RiccardoSH it should return obj[checkProp] this is known as bracket notation
Riccardo
@RiccardoSH
May 14 2017 02:19
thanks it worked :) is the strict equality operator === correct in tis case? @FlashHero
CamperBot
@camperbot
May 14 2017 02:19
riccardosh sends brownie points to @flashhero :sparkles: :thumbsup: :sparkles:
:cookie: 181 | @flashhero |http://www.freecodecamp.com/flashhero
Csaba Balogh
@JasonCorp84
May 14 2017 02:19
Good evening
I am working on chunky monkey
function chunkArrayInGroups(arr, size) {
// Break it up.
var nestArrFront = [arr.slice(0,size)];//to slice arr from index 0 to index size
for (var i = size; i < arr.length+1; i += i){
var nestArrEnd = arr.slice(i, i+i);
nestArrFront.push(nestArrEnd);
return nestArrFront;
}
}
this only runs twice and stops the iteration .
any hint would help
FlashHero
@FlashHero
May 14 2017 02:23
@RiccardoSH yes freecodecamp wants you to use strict equality operator in almost anything anyway the .hasOwnProperty returns boolean which is true or false so
Riccardo
@RiccardoSH
May 14 2017 02:26
yes I just tried again after removing the strict euality and it still works
thanks
FlashHero
@FlashHero
May 14 2017 02:29
@JasonCorp84 you want to return nestArrFront outside the loop return stops the iteration of the loop
Csaba Balogh
@JasonCorp84
May 14 2017 02:30
@FlashHero thank you lol
CamperBot
@camperbot
May 14 2017 02:30
jasoncorp84 sends brownie points to @flashhero :sparkles: :thumbsup: :sparkles:
:cookie: 182 | @flashhero |http://www.freecodecamp.com/flashhero
Csaba Balogh
@JasonCorp84
May 14 2017 02:30
this is the 11th time at least when I do the same mistake
FlashHero
@FlashHero
May 14 2017 02:30
did it work ?
Csaba Balogh
@JasonCorp84
May 14 2017 02:31
better than it was, but still not perfect
passes everything except one
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:37
I'm trying to check for a palindrome. I am thinking that if you do the .replace method to replace it with the same word, and if it is the same word it will give a true.
Am I on the right track so far?
function palindrome(str) {
  var check = str.replace();
  return true;
}



palindrome("eye");
FlashHero
@FlashHero
May 14 2017 02:37
@JasonCorp84 you have arr.length+1 you shouldn't have +1
Jianhao Tan
@jaanhio
May 14 2017 02:38
@ArchivalBoat50 you can just flip the words and compare them
@ArchivalBoat50 “abc”.flip = “cba”
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:38
so something like if word.flip = true then return true?
Jianhao Tan
@jaanhio
May 14 2017 02:39
yup
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:39
@jaanhio ok thx let me try that
CamperBot
@camperbot
May 14 2017 02:39
archivalboat50 sends brownie points to @jaanhio :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @jaanhio |http://www.freecodecamp.com/jaanhio
Csaba Balogh
@JasonCorp84
May 14 2017 02:40

the problem is going to be here: for (var i = size; i < arr.length; i +=i){
var nestArrEnd = arr.slice(i, i + i);
nestArrFront.push(nestArrEnd);

}

after the second iteration itt will double the nested array's size
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:42

@jaanhio
Well here is what I have now:

function palindrome(str) {
  var check = str.flip;
  if (check === str) {


  return true;
  }
 else {
   return false;
 }
  }



palindrome("eye");

Not sure what I did wrong here.

FlashHero
@FlashHero
May 14 2017 02:43
@JasonCorp84 it should be incremented by i+=size which is the second parameter so inside the loop push the sliced value to an empty array and return that outside the loop
Jianhao Tan
@jaanhio
May 14 2017 02:43
@ArchivalBoat50 sorry the .flip was just a pseudocode of saying you have the reverse the string
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:44
@jaanhio lol i was about to say
Csaba Balogh
@JasonCorp84
May 14 2017 02:45
@FlashHero thank you again. It works now.. I always mess these 2 up
@jaanhio yest but you can use something to flip that actually
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:46
@jaanhio
Is this more like it?
function palindrome(str) {
  var check = str.split().reverse().join();
  if (check === str) {


  return true;
  }
 else {
   return false;
 }
  }



palindrome("eye");
Csaba Balogh
@JasonCorp84
May 14 2017 02:47
return (check === true); is the same
I mean :D
vince nguyen
@moomoo2202
May 14 2017 02:48
what is the difference between \r and \n?
Csaba Balogh
@JasonCorp84
May 14 2017 02:48
return (check === ture);
Jianhao Tan
@jaanhio
May 14 2017 02:48
@ArchivalBoat50 yea something like that
ArchivalBoat50
@ArchivalBoat50
May 14 2017 02:48
@jaanhio
@jaanhio
Though there is still something wrong, it must be in the part where I am returning. Do you know what I'm doign wrong here?
vince nguyen
@moomoo2202
May 14 2017 02:50
do check == str
Jianhao Tan
@jaanhio
May 14 2017 02:51
@ArchivalBoat50 you forgot to remove all non-alphanumberic chars
vince nguyen
@moomoo2202
May 14 2017 02:51
that should work
if (check == str) {
and add '' in the split function, check = str.split('').reverse().join();
Jianhao Tan
@jaanhio
May 14 2017 02:53
@ArchivalBoat50
  1. replace all non-alphanumeric chars
    2.now compare the alphanumeric string and its reversed form
function binaryAgent(str) {
  var binaryArr=str.split(" ");
  var binarySubArr=[];
  for(var i=0;i<binaryArr.length;i++){
    binarySubArr.push(binaryArr[i].split(""));
  }

  //var sum=0;
  var sumArr=[];
  for(var j=0;j<binarySubArr.length;j++){
    var sum=0;
    for(var k=0;k<binarySubArr[j].length;k++){
      //var sum=0;
      if(binarySubArr[j][k]=="1"){
        if(k===0){
          sum+=(1*128);
        }
        else if(k==2){
          sum+=(1*64);
        }
        else if(k==3){
          sum+=(1*32);
        }
        else if(k==4){
          sum+=(1*16);
        }
        else if(k==5){
          sum+=(1*8);
        }
        else if(k==6){
          sum+=(1*4);
        }
        else if(k==7){
          sum+=(1*2);
        }
        else if(k==8){
          sum+=1;
        }
      }
      //sumArr.push(sum);
    }
    sumArr.push(sum);
  }
  return sumArr;
}
may i know why am i not getting the correct binary sum?
binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");
i should be getting 68 for the first binary code but getting only 2 instead
Francisco Franco
@frenktico
May 14 2017 02:56
Heeeey
Let's talk about JS and issues with switch that can't be found :/

function chainToSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch (val){  
    case 1:
      val = "bob";
      answer = "Marley";
      break;
    case 2:
      val = 42;
      answer = "The Answer";
      break;
    case 3:
      val = 1;
      answer = "There is no #1";
      break;
    case 4:
      val = 99;
      answer = "Missed me by this much!";
      break;
    case 5:
      val = 7;
      answer = "Ate Nine";
      break;
  }
  // Only change code above this line  
  return answer;  
}

// Change this value to test
chainToSwitch(7);
Jianhao Tan
@jaanhio
May 14 2017 02:58
@frenktico why is there a val within your switch statement?
Francisco Franco
@frenktico
May 14 2017 02:58
Shouldn't have?
Sophie
@sophie3669
May 14 2017 02:58
hello pls i need someonte to explain how i should go about title casing a sentence
Francisco Franco
@frenktico
May 14 2017 02:58
I thought it should
vince nguyen
@moomoo2202
May 14 2017 02:59
you forgot the default part
Jianhao Tan
@jaanhio
May 14 2017 03:01
@frenktico what is name of that challenge?
Jason G
@Jay33Canada
May 14 2017 03:02
@jaanhio i'm not exactly sure what you mean to do with your logic? what is happening with those if statements
Gabe Rotberg
@grotberg
May 14 2017 03:02
@frenktico the "case" lines need to have the value you're trying to match. So case "bob": ..., not case 1: val = "bob"
Jianhao Tan
@jaanhio
May 14 2017 03:03
@Jay33Canada oh i figured it out already! i mistyped one of the if statements haha
Francisco Franco
@frenktico
May 14 2017 03:03
@grotberg thank you that is what was my mistake
CamperBot
@camperbot
May 14 2017 03:03
frenktico sends brownie points to @grotberg :sparkles: :thumbsup: :sparkles:
:cookie: 368 | @grotberg |http://www.freecodecamp.com/grotberg
Gabe Rotberg
@grotberg
May 14 2017 03:03
@frenktico the current statement basically says "if val == 1, then set val equal to bob and answer equal to marley"
Francisco Franco
@frenktico
May 14 2017 03:04
@jaanhio it was an exercise to change if else chains to switch
Gabe Rotberg
@grotberg
May 14 2017 03:04
@sophie3669 well, putting the logic in plain english - you need to go through your string and capitalize the first (and only the first) letter of each word
Jason G
@Jay33Canada
May 14 2017 03:04
dude your logic is confusing. i don't get it. @jaanhio . here's what i did

function binaryAgent(str) {
  //get the index of the spaces

  var words = str.split(" ");
  var letterArray = [];
  var joined = "";
  for (var i = 0; i < words.length; i++){
    letterArray[i] = parseInt(words[i], 2);
    letterArray[i] = String.fromCharCode(letterArray[i]);
    joined = letterArray.join("");
  }
  return joined ;
}
Francisco Franco
@frenktico
May 14 2017 03:04
Yeah @grotberg my error was the way I was thinking on how to proper solve it
ArchivalBoat50
@ArchivalBoat50
May 14 2017 03:07

How do I replace the alpha-numeric characters?

function palindrome(str) {
  str = str.replace(/W/g);
  var check = str.split("").reverse("").join("");
  if (check === str) {
  return true;
  }
 else {
   return false;
 }
  }



palindrome("eye");

This is what I have so far

non-aplhanumeric i meant
Sophie
@sophie3669
May 14 2017 03:07

~~~
var newVal = [];
function titleCase(str) {
var strsplit = str.split('');
for(var i = 0; i < strsplit.length; i++){

 {
   var newWord = strsplit[i].toUpperCase();
newVal += newWord;


 }

return newVal;

}

}

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

Jianhao Tan
@jaanhio
May 14 2017 03:08
@ArchivalBoat50 you can replace it with ‘’, essentially removing it
@Jay33Canada wow thanks! that looks much neater
mine is working now but yea its a mess
function binaryAgent(str) {
  var binaryArr=str.split(" ");
  var binarySubArr=[];
  for(var i=0;i<binaryArr.length;i++){
    binarySubArr.push(binaryArr[i].split(""));
  }

  //var sum=0;
  var sumArr=[];
  for(var j=0;j<binarySubArr.length;j++){
    var sum=0;
    for(var k=0;k<binarySubArr[j].length;k++){
      //var sum=0;
      if(binarySubArr[j][k]=="1"){
        if(k===0){
          sum+=(1*128);
        }
        else if(k==1){
          sum+=(1*64);
        }
        else if(k==2){
          sum+=(1*32);
        }
        else if(k==3){
          sum+=(1*16);
        }
        else if(k==4){
          sum+=(1*8);
        }
        else if(k==5){
          sum+=(1*4);
        }
        else if(k==6){
          sum+=(1*2);
        }
        else if(k==7){
          sum+=1;
        }
      }
      //sumArr.push(sum);
    }
    sumArr.push(sum);
  }
  var charArr=sumArr.map(function(x){
    return String.fromCharCode(x);
  });
  var charString=charArr.join("");
  return charString;

}
CamperBot
@camperbot
May 14 2017 03:08
jaanhio sends brownie points to @jay33canada :sparkles: :thumbsup: :sparkles:
:cookie: 340 | @jay33canada |http://www.freecodecamp.com/jay33canada
ArchivalBoat50
@ArchivalBoat50
May 14 2017 03:10
@jaanhio What do you mean?
Jianhao Tan
@jaanhio
May 14 2017 03:10
@ArchivalBoat50
function palindrome(str) {

  var re = /[\W_]/g;

  var lowerStr = str.toLowerCase().replace(re, '');

  var lowerStrArr = lowerStr.split("");

  var reversedStr = lowerStrArr.reverse().join("");

  if(reversedStr == lowerStr){
    return true;
  }
  else{
    return false;
  }
}
Jason G
@Jay33Canada
May 14 2017 03:12
@jaanhio i'm glad you figured it out. i don't get how you did it but. good job lol
ok i thought it through. i get your code now. interesting way of doing that challenge.
Long Nguyen
@longnt80
May 14 2017 03:16
@jaanhio no it's not a mess, it's amazing
Jianhao Tan
@jaanhio
May 14 2017 03:17
@longnt80 @Jay33Canada lol. it looked kinda like a “brute force” way of solving it
Jason G
@Jay33Canada
May 14 2017 03:17
it's smart. i wouldn't have thought of that. it's maybe unnecessarily complicated though.
Jianhao Tan
@jaanhio
May 14 2017 03:18
trying to figure out how parseInt works :worried:
Jason G
@Jay33Canada
May 14 2017 03:19
I was going to start this Arguments Optional challenge tonight but I don't even really know what they are asking us to do. The examples below are weird syntax I've never seen before.
like this for example
addTogether(2)(3) should return 5.
Long Nguyen
@longnt80
May 14 2017 03:19
@jaanhio it's sure the hard way but it really shows the understanding of binary

Parameters

string
The value to parse. If the string argument is not a string, then it is converted to a string (using the ToString abstract operation). Leading whitespace in the string argument is ignored.
radix
An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify 10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
Return value

An integer number parsed from the given string. If the first character cannot be converted to a number, NaN is returned.

Long Nguyen
@longnt80
May 14 2017 03:24
@Jay33Canada you need to read the link they give you about Closures
Jason G
@Jay33Canada
May 14 2017 03:24
so parseInt("00000001", 2) means
I want you to return an integer (in our number system, base ten) FROM this string "00000001" in THIS number system (the second argument, which happens to be base 2 aka binary)
I read it @longnt80
Long Nguyen
@longnt80
May 14 2017 03:24
the example in there is exactly that case
Jason G
@Jay33Canada
May 14 2017 03:25
there is zero mention of any syntax like addTogether(2)(3) should return 5.
addTogether(2,3) makes sense. addTogether(2)(3) does not make sense
Jianhao Tan
@jaanhio
May 14 2017 03:25
@Jay33Canada OHHH i was about to ask so what does radix=2 actually do
@Jay33Canada thanks man for the explanation!
CamperBot
@camperbot
May 14 2017 03:25
jaanhio sends brownie points to @jay33canada :sparkles: :thumbsup: :sparkles:
:warning: jaanhio already gave jay33canada points
Long Nguyen
@longnt80
May 14 2017 03:25
the example in that link is exactly the case addTogether(2)(3)
barki mustapha
@barkinet
May 14 2017 03:26

<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

' Create a new GridView object.
Dim customersGridView As New GridView()

' Set the GridView object's properties.
customersGridView.ID = "CustomersGridView"
customersGridView.DataSourceID = "CustomersSource"
customersGridView.AutoGenerateColumns = True

' Add the GridView object to the Controls collection
' of the PlaceHolder control.
GridViewPlaceHolder.Controls.Add(customersGridView)

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>GridView Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">

<h3>GridView Constructor Example</h3>

<asp:placeholder id="GridViewPlaceHolder" runat="Server"/>

<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [City] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/>

</form>
</body>
</html>

Jason G
@Jay33Canada
May 14 2017 03:26
anytime @jaanhio :)
show me the example then @longnt80 i must have missed it
Joseph
@revisualize
May 14 2017 03:27
Hey hey.
Long Nguyen
@longnt80
May 14 2017 03:28
@Jay33Canada ok let me get it
Jason Luboff
@JLuboff
May 14 2017 03:28
@revisualize What up
Joseph
@revisualize
May 14 2017 03:28
Chillin'. I'm fasting today. Hopefully I'll last the whole 42 hours.
Jason Luboff
@JLuboff
May 14 2017 03:29
Any reason why?
Joseph
@revisualize
May 14 2017 03:29
Just thought I'd give it a shot.
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:29
morning
Jason Luboff
@JLuboff
May 14 2017 03:29
Evening
Jason G
@Jay33Canada
May 14 2017 03:29
morning? it's 11:30pm here!
Jason Luboff
@JLuboff
May 14 2017 03:29
8:30 PM here. @HeebieGeeBee is... 5:30 am?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:30
yeah
Long Nguyen
@longnt80
May 14 2017 03:30
@Jay33Canada

function makeAdder(x) {
return function(y) {
return x + y;
};
}

var add5 = makeAdder(5);
var add10 = makeAdder(10);

console.log(add5(2)); // 7
console.log(add10(2)); // 12

Jason G
@Jay33Canada
May 14 2017 03:30
holy crap you're up early then @HeebieGeeBee
@longnt80 i saw that but it does not match this syntax addTogether(2)(3) should return 5.
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:30
seems so
Long Nguyen
@longnt80
May 14 2017 03:30
@Jay33Canada makeAdder(5)(2)
Jason G
@Jay33Canada
May 14 2017 03:30
see how they have to closed thingys like this (2)(3) touching eachother?
Long Nguyen
@longnt80
May 14 2017 03:31
it is
Jason G
@Jay33Canada
May 14 2017 03:31
they don't do that in the example
i've never seen syntax like this addTogether(2)(3)
as far as I know, all parameters/ argument need to be inside of the ()'s
Long Nguyen
@longnt80
May 14 2017 03:32
@Jay33Canada makeAdder(5)(2)
Jason G
@Jay33Canada
May 14 2017 03:32
that's not in your example lol
Gabe Rotberg
@grotberg
May 14 2017 03:33
@Jay33Canada , I'd never seen it in the wild before that exercise, but think about it this way - it evaluates the addTogether(2) part first, and returns it as another function which evalutes to returnedFunction(3)
Long Nguyen
@longnt80
May 14 2017 03:34
@Jay33Canada add5 is makeAdder(5)
Jason G
@Jay33Canada
May 14 2017 03:34
it's the syntax i don't get why it's being done like that
Gabe Rotberg
@grotberg
May 14 2017 03:34
@Jay33Canada so when it returns function(x) {...whatever...} that second argument (or set of arguments) is being passed to the x
Long Nguyen
@longnt80
May 14 2017 03:35
So add5(2) is makeAdder(5)(2)
Jason G
@Jay33Canada
May 14 2017 03:35
does this actually mean makeAdder(5)function(2){return x+y;}?
Long Nguyen
@longnt80
May 14 2017 03:35
@Jay33Canada copy that example and play with it
It's your answer
Gabe Rotberg
@grotberg
May 14 2017 03:36
@Jay33Canada sort of. the function(2) is still happening inside the original makeAdder function, so it has access to the local variable to add them together and return it
@Jay33Canada its is admittedly a little mindblowing.
Jason G
@Jay33Canada
May 14 2017 03:37
oh ok @grotberg and @longnt80 that's really weird that it is NEVER explained lol they never say that it can be written like this in the example (5)(2)
but i get it after understanding your explanations
Long Nguyen
@longnt80
May 14 2017 03:37
Just tinker with that example then you'll get it
Joseph
@revisualize
May 14 2017 03:39
Currying.
Jason G
@Jay33Canada
May 14 2017 03:39
i get what's happening. the main function runs, it returns a function which has values in it because of it being in a closure. so it remembers them. but it's just odd, i guess, that the function it returns, can be ran immediately afterwords with func(meFirst)(meNext)
Ogundele Olumide
@Lumexralph
May 14 2017 03:40
@Jay33Canada if you take time to understand closure
Jason G
@Jay33Canada
May 14 2017 03:40
i do understand closure lol i just explained it
what i'm saying is weird, is the unexpected syntax
Ogundele Olumide
@Lumexralph
May 14 2017 03:40
@Jay33Canada cool......you're good :smile:
Jason G
@Jay33Canada
May 14 2017 03:41
Thank for all the points of view guys :)
Ogundele Olumide
@Lumexralph
May 14 2017 03:45
@Jay33Canada :+1:
Jason G
@Jay33Canada
May 14 2017 03:48
is there a way to check to see if something is a number?
a boolean i mean
Ogundele Olumide
@Lumexralph
May 14 2017 03:49
@Jay33Canada typeof
Jason G
@Jay33Canada
May 14 2017 03:49
oh yea! derp. thanks @Lumexralph
CamperBot
@camperbot
May 14 2017 03:49
jay33canada sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1737 | @lumexralph |http://www.freecodecamp.com/lumexralph
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:50
@Lumexralph mornin
Ogundele Olumide
@Lumexralph
May 14 2017 03:52
@HeebieGeeBee Good Morning :smile: , slept well?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:52
not especially, you?
Ogundele Olumide
@Lumexralph
May 14 2017 03:52
@HeebieGeeBee I did.... can I puzzle you a lil? JS stuff
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:53
you sure, nto sure how well i can answer
Jason Luboff
@JLuboff
May 14 2017 03:53
Let's hear it @Lumexralph
Ogundele Olumide
@Lumexralph
May 14 2017 03:54
@HeebieGeeBee What is the prototype of Object.prototype ?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 03:55
no idea
Jason Luboff
@JLuboff
May 14 2017 03:55
Maybe it has no prototype
Ogundele Olumide
@Lumexralph
May 14 2017 03:55
@JLuboff Morning here, Night there.... Good here
Jason Luboff
@JLuboff
May 14 2017 03:55
Lol
Ogundele Olumide
@Lumexralph
May 14 2017 03:57
@JLuboff what's the value if you use Object.getPrototypeOf method ?
Jason Luboff
@JLuboff
May 14 2017 03:57
I dunno
Ogundele Olumide
@Lumexralph
May 14 2017 03:57
@HeebieGeeBee it has no prototype, true but it has a value
@JLuboff null and you know the beauty ?
@JLuboff you can create an object or use a constructor to create instances once you assign null as the value to the prototype property of that constructor, it's not prototype-linked to any other object
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:01
so why is that beautiful?
susaint
@susaint
May 14 2017 04:02
Access MultiDimensional Arrays With Indexes .............looks simple but unable to figure out
Ogundele Olumide
@Lumexralph
May 14 2017 04:03
@HeebieGeeBee when you use operators like in it goes through the prototypes too
@HeebieGeeBee imagine if you want to use an object to simply store something ?
Jason G
@Jay33Canada
May 14 2017 04:03
woohoo! I just finished the intermediate algorithms :D:D:D
function addTogether(a, b) {
  var argLen = arguments.length;

    if (argLen === 2){
      if (typeof a !== "number" || typeof b !== "number"){
        return undefined;
      }
      else{
      return a + b;
      }
    }
    else if (argLen === 1){
      if (typeof a !== "number"){
        return undefined;
      }
      else{
        return function(c){
          if (typeof c !== "number"){
            return undefined;
          }
          else{
            return a + c;
          }
        };
      }  
    }
}
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:04
@Jay33Canada well done
Joseph
@revisualize
May 14 2017 04:05
@Jay33Canada I did it a little differently if you'd like to see my solution.
Jason G
@Jay33Canada
May 14 2017 04:05
i really struggled with two of those challenges. Sum All Primes and Steam Roller. Glad I got through them though. I think I spent more than 50 hours on the whole section
Joseph
@revisualize
May 14 2017 04:06
@susaint How can we help? Would you like to walk through an example?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:06
@Lumexralph im not i get the significance sorry, but i know it must be something good if youre happy about it
Jason G
@Jay33Canada
May 14 2017 04:06
ya sure @revisualize
Joseph
@revisualize
May 14 2017 04:06
@Jay33Canada
function addTogether() {
    if (arguments.length === 2 &&
        typeof arguments[0] === "number" &&
            !Number.isNaN(arguments[0]) &&
                typeof arguments[1] === "number" &&
                    !Number.isNaN(arguments[1])) {
                        return arguments[0] + arguments[1];
      }
    if (arguments.length === 1 &&
        typeof arguments[0] === "number" &&
            !Number.isNaN(arguments[0])) {
                var arg0 = arguments[0];
                return function() {
                    if (typeof arguments[0] === "number" &&
                        !Number.isNaN(arguments[0])) {
                            return arg0 + arguments[0];
                    }
                 };
    }
}
Ogundele Olumide
@Lumexralph
May 14 2017 04:06
@HeebieGeeBee just like a dictionary or store, stand alone stuff and you want to eliminate any threats of property names clashing ? you can do that knowing fully well it's not linked to any prototype object
Jason G
@Jay33Canada
May 14 2017 04:06
thanks @HeebieGeeBee :)
CamperBot
@camperbot
May 14 2017 04:06
jay33canada sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1639 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:06
@Lumexralph oh right ok
barki mustapha
@barkinet
May 14 2017 04:08
Thanks for the clarification. GridView's HTML structure is complex and slightly differs from a standard bootstrap grid. So, there is no easy and straightforward way to apply the same CSS classes to our grid. I suggest you take a look at Moderno and Mulberry themes. They provide appearance similar to Bootstrap. In addition, you can create a custom theme based on these themes using our ASP.NET Theme Builder to make the grid appearance more alike.
Jason G
@Jay33Canada
May 14 2017 04:08
what does this mean @revisualize !Number.isNaN(arguments[1])?
Joseph
@revisualize
May 14 2017 04:08
So, I just passed 24hrs without eating. Hmmm.. I don't know how I feel about the fact that I'm not hungry.
@Jay33Canada Not Number isNan arguments[1]
Ogundele Olumide
@Lumexralph
May 14 2017 04:09
@HeebieGeeBee I understand why JS tried to mimic the class concept in languages like Python Java etc.. they're used to the class concept and if I came from that language to JS , I might hate JS for it :smile:
Joseph
@revisualize
May 14 2017 04:09
@Jay33Canada I'm basically trying to see if arguments[1] is not "Not a Number"
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:09
@Lumexralph ive been trying to make classes
Ogundele Olumide
@Lumexralph
May 14 2017 04:09
@HeebieGeeBee in JS ?
Jason G
@Jay33Canada
May 14 2017 04:09
why @revisualize ? what if they send you an array?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:09
to create objects in a canvas
yes
Joseph
@revisualize
May 14 2017 04:10
@Jay33Canada Is an array not NaN?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:10
but im not sure what the advantage is over just a normal constructor function
Joseph
@revisualize
May 14 2017 04:10
@Jay33Canada Follow the chain of logic.
Jason G
@Jay33Canada
May 14 2017 04:11
well even is an array is NaN, what about other things, they send you false, undefine, null etc
John
@flyboy1565
May 14 2017 04:11
Anyone in here great with vue.js?
Ogundele Olumide
@Lumexralph
May 14 2017 04:11
@HeebieGeeBee it won't be a really big deal if JS was your first
Joseph
@revisualize
May 14 2017 04:11
@Jay33Canada I think you're following my logic chain backwards.
Jason G
@Jay33Canada
May 14 2017 04:11
I think it's much better to do it the way i did because it will work no matter what gets passed as an argument
yours will have issues with things like null or undefined being passed
Joseph
@revisualize
May 14 2017 04:11
@Jay33Canada
(arguments.length === 2 &&
        typeof arguments[0] === "number" &&
            !Number.isNaN(arguments[0]) &&
                typeof arguments[1] === "number" &&
                    !Number.isNaN(arguments[1]))
@Jay33Canada How?
@Jay33Canada typeof arguments[1] === "number"
Ogundele Olumide
@Lumexralph
May 14 2017 04:13
@HeebieGeeBee there's not really significant different, JS made class to be easy for other programmers that have a different OOP understanding, that's what I think
Joseph
@revisualize
May 14 2017 04:13
@Jay33Canada What is the typeof undefined or null ?
@Jay33Canada Are they numbers?
Jason G
@Jay33Canada
May 14 2017 04:13
no
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:13
@Lumexralph oh right
Joseph
@revisualize
May 14 2017 04:13
@Jay33Canada So, false. Therefore that if statement won't get triggered.
@Jay33Canada Is NaN typeof a number?
Kelechi Chinaka
@ke1echi
May 14 2017 04:14
i think js is purely prototypal @Lumexralph
Jason G
@Jay33Canada
May 14 2017 04:14
doesn't Number.isNaN() check to see if something is not a number?
Ogundele Olumide
@Lumexralph
May 14 2017 04:14
@HeebieGeeBee i like canvas too, the maths and physics that'll be applied
Joseph
@revisualize
May 14 2017 04:14
@Jay33Canada Number.isNaN() checks if something is NaN
Ogundele Olumide
@Lumexralph
May 14 2017 04:14
@kelechichinaka i agree
Joseph
@revisualize
May 14 2017 04:15
@Jay33Canada But, the typeof NaN is a "number"
Ogundele Olumide
@Lumexralph
May 14 2017 04:15
@HeebieGeeBee I have not spent enough time with JS canvas though but i know i'll love it when I do
Joseph
@revisualize
May 14 2017 04:15
> typeof NaN
<- "number"
Jason G
@Jay33Canada
May 14 2017 04:15
i just don't see why you're checking for that at all @revisualize
Joseph
@revisualize
May 14 2017 04:16
@Jay33Canada First I'm checking to make sure the argument value is a number.
But, I also need to make sure it is not NaN because NaN is a "number"
@Jay33Canada Because 2000 + NaN is ... NaN
Ogundele Olumide
@Lumexralph
May 14 2017 04:16
@kelechichinaka Good Morning Brotherly
Jason G
@Jay33Canada
May 14 2017 04:17
all you want to know, is if arguments[0] or where ever, is a number or not. why not use typeof arugments[0] !== "number" this covers all cases
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:17
@Lumexralph I was gonna try and do the whole portfolio project as one canvas
Jason G
@Jay33Canada
May 14 2017 04:17
ohhh so mine might have an issue if i was passed NaN?
Joseph
@revisualize
May 14 2017 04:17
@Jay33Canada Yes.
Kelechi Chinaka
@ke1echi
May 14 2017 04:17
morning bro @Lumexralph
Joseph
@revisualize
May 14 2017 04:17
Because NaN is a number.
Ogundele Olumide
@Lumexralph
May 14 2017 04:17
@HeebieGeeBee cool, that's good motivation
Jason G
@Jay33Canada
May 14 2017 04:18
@revisualize where do you return undefined? i don't see that anywhere
Joseph
@revisualize
May 14 2017 04:18
@Jay33Canada Functions return undefined by default
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:18
@Lumexralph i spent ages ust making a scroll bar though
Jason G
@Jay33Canada
May 14 2017 04:18
if you don't return something, they'll return undefined?
how'd you learn dis magik doe?
Joseph
@revisualize
May 14 2017 04:18
@Jay33Canada Yup.
intcreate
@intcreate
May 14 2017 04:19
undefined means no value was provided
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:19
and im trying to figure out how to make it all come together
Ogundele Olumide
@Lumexralph
May 14 2017 04:19
@HeebieGeeBee :joy: .... trust me I understand
Joseph
@revisualize
May 14 2017 04:19
@Jay33Canada
The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:19
@Lumexralph but now cus of how ive created all the setup
its becoming like a sketch library
Ogundele Olumide
@Lumexralph
May 14 2017 04:20
@HeebieGeeBee a lot of calculations placing stuff on canvas using coordinates, right?
Jason G
@Jay33Canada
May 14 2017 04:20
oh interesting. i've never looked at the doc for return before lol never thought to
Ogundele Olumide
@Lumexralph
May 14 2017 04:21
@HeebieGeeBee meaning you can use your mouse draw, right?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:21
yeah figuring out all the bounds for like when mouse is over it and stuff
no i mean, i think im just creating a mini js library like p5
Ogundele Olumide
@Lumexralph
May 14 2017 04:22
@HeebieGeeBee i haven't used p5, don't know what it's about
@HeebieGeeBee remember you've told me
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:22
but im trying to make it all responsive
Joseph
@revisualize
May 14 2017 04:22
@Jay33Canada Does it make sense now why I did that?
Ogundele Olumide
@Lumexralph
May 14 2017 04:22
@HeebieGeeBee okay
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:23
so i created a responsive like a dynamic value based on the percentage of the size of the window
Jason G
@Jay33Canada
May 14 2017 04:23
ya that makes sense @revisualize I just played around with this. it was interesting
var h = function(){return "hey";};
undefined
h
function (){return "hey";}
h();
"hey"
var h = function(){return;};
undefined
h
function (){return;}
h()
undefined
h();
undefined
var h = function(){};
undefined
h
function (){}
h();
undefined
Kelechi Chinaka
@ke1echi
May 14 2017 04:24
is there a way i can refer to all falsy values 0, -0, "", null, undefined, NaN @Lumexralph @HeebieGeeBee
Joseph
@revisualize
May 14 2017 04:24
@kelechichinaka Boolean()
Jason G
@Jay33Canada
May 14 2017 04:24
yes @kelechichinaka
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:24
but cus im using constructors for all the canvas objects, i have to reset all the size values for every instance i make
gaitchs gangmei
@gaitchs
May 14 2017 04:24
i need help at counting cards , challenge 198
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:24
whenever the window is resized
Joseph
@revisualize
May 14 2017 04:25
@gaitchs Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:25
so trying to think if there is a better way of doing that
Jason G
@Jay33Canada
May 14 2017 04:25
ok have a good night guys. i'm off to bed :)
Kelechi Chinaka
@ke1echi
May 14 2017 04:25
does Boolean not refer to truthy to? @revisualize @Jay33Canada
HeebieGeeBee
@HeebieGeeBee
May 14 2017 04:25
im wondering if theres ways to add events listening to the actual constructors
Jason G
@Jay33Canada
May 14 2017 04:26
don't confuse the poor guy @revisualize lol
look at this line @kelechichinaka
var x = Boolean(expression);     // preferred
var x = new Boolean(expression); // don't use
gaitchs gangmei
@gaitchs
May 14 2017 04:27
@revisualize thanks
CamperBot
@camperbot
May 14 2017 04:27
gaitchs sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3957 | @revisualize |http://www.freecodecamp.com/revisualize
Jason G
@Jay33Canada
May 14 2017 04:27
do not use new. all of the examples except one use new. but don't use new. just use Boolean();
i hate that docs cause it confused the crap out of me for like 20 minutes
Kelechi Chinaka
@ke1echi
May 14 2017 04:28
i prefer the docs.. thanks @revisualize
CamperBot
@camperbot
May 14 2017 04:28
kelechichinaka sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3958 | @revisualize |http://www.freecodecamp.com/revisualize
Kelechi Chinaka
@ke1echi
May 14 2017 04:28
thanks @Jay33Canada
CamperBot
@camperbot
May 14 2017 04:28
kelechichinaka sends brownie points to @jay33canada :sparkles: :thumbsup: :sparkles:
:cookie: 342 | @jay33canada |http://www.freecodecamp.com/jay33canada
Jason G
@Jay33Canada
May 14 2017 04:28
ok. now i'm off to bed. goodnight all
Ogundele Olumide
@Lumexralph
May 14 2017 04:30
@kelechichinaka using the Boolean constructor coerces the value to true or false based on their truthy or falsyness
@HeebieGeeBee I think you can
@HeebieGeeBee you just have to give the constructor a method that does that for all instances or any instance of that constructor
zhang0102003
@zhang0102003
May 14 2017 04:35
please help me

<script>
function runSlots() {
var slotOne;
var slotTwo;
var slotThree;

var images = ["//i.imgur.com/9H17QFk.png", "//i.imgur.com/9RmpXTy.png", "//i.imgur.com/VJnmtt5.png"];

slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;


// Only change code below this line.



// Only change code above this line.

if (slotOne === slotTwo && slotTwo === slotThree) {
  $(".logger").html(" It's A Win")
  return null;
}

if (slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
  $(".logger").html(slotOne + " " + slotTwo + " " + slotThree);
}

$(".logger").append(" Not A Win");


return [slotOne, slotTwo, slotThree];

}

grfraser
@grfraser
May 14 2017 04:36
anyone know anything about APIs? I feel like there was not much material covered and now I am struggling with the random quote generator.
@deuscode
gaitchs gangmei
@gaitchs
May 14 2017 04:43

var count = 0;

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

  if(card < 6)
   count +1;
  return count;
  if(card < )

  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');
Ogundele Olumide
@Lumexralph
May 14 2017 04:43
can't load the page, don't know why.... you can ask your question
gaitchs gangmei
@gaitchs
May 14 2017 04:43
challenge 198
counting cards
no clue
Ogundele Olumide
@Lumexralph
May 14 2017 04:44
@gaitchs you need to check card against the values to either decrement or increment
gaitchs gangmei
@gaitchs
May 14 2017 04:44
running out of logic in my head
Ogundele Olumide
@Lumexralph
May 14 2017 04:44
@gaitchs then you later check if count is positive or negative to return count + string
@gaitchs you can use switchstatement or just if expressions to check the card value
gaitchs gangmei
@gaitchs
May 14 2017 04:45
example code ?
stuck wiht if statement
i check < first or > first ?
start checking from less first ?
Ogundele Olumide
@Lumexralph
May 14 2017 04:48
@gaitchs if card is 2 or 3 or 4 or 5...... increment count count += 1
@gaitchs if card is J, K, Q ..... decrement count count -= 1
@gaitchs get your card values right, just giving you a pointer
gaitchs gangmei
@gaitchs
May 14 2017 04:49
if card is J || K || Q ??
Ogundele Olumide
@Lumexralph
May 14 2017 04:49
@gaitchs it'll be card === "J" || card === "K".....
grfraser
@grfraser
May 14 2017 04:50
anyone know how to use an API on codepen for Random Quote Generator?
gaitchs gangmei
@gaitchs
May 14 2017 04:52

var count = 0;

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

  if(card < 6)
   count += 1;
  else if (card < 9)
    count = 0;
  else if(card === 10 || card === "J" || card === "Q" || card === "K" || card === "A" )
    count = -1;

  return "count";
  // 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');
not working
Joseph
@revisualize
May 14 2017 04:52
@gaitchs Did you read what I wrote?
Ogundele Olumide
@Lumexralph
May 14 2017 04:52
@grfraser you'll need to make an AJAX or AJAJ request for that, the API will have a URL you can get the data from
Joseph
@revisualize
May 14 2017 04:53
@gaitchs Doing count = -1 is assigning the value -1 to count. It isn't subtracting 1.
Sherlock Holmes
@GGX666
May 14 2017 04:53
image.png
intcreate
@intcreate
May 14 2017 04:53
wats that
Joseph
@revisualize
May 14 2017 04:53
@GGX666 Grats?
WannaCry
Sherlock Holmes
@GGX666
May 14 2017 04:53
yes
oh my god
gaitchs gangmei
@gaitchs
May 14 2017 04:53
var count = 0;

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

  if(card < 6)
   count += 1;
  else if (card < 9)
    count = 0;
  else if(card === 10 || card === "J" || card === "Q" || card === "K" || card === "A" )
    count -= 1;

  return "count";
  // 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');
Sherlock Holmes
@GGX666
May 14 2017 04:54
WannaCry
@revisualize i wanna cry
gaitchs gangmei
@gaitchs
May 14 2017 04:54
@GGX666 same here bro
Ogundele Olumide
@Lumexralph
May 14 2017 04:55
@gaitchs check what @revisualize posted
gaitchs gangmei
@gaitchs
May 14 2017 04:55
me with sadness
count -= 1 ?
mitron6
@mitron6
May 14 2017 05:02
@gaitchs not count = 0; Just don't change count?
grfraser
@grfraser
May 14 2017 05:02
@Lumexralph im confused on how to mix it in with the html though
i found a site claiming to generate random quotes but they dont appear
Ogundele Olumide
@Lumexralph
May 14 2017 05:03
@gaitchs
else if (card < 9)
    count = 0;
mitron6
@mitron6
May 14 2017 05:03
@gaitchs The column is labeled "Count Change"
grfraser
@grfraser
May 14 2017 05:03
i put the right classes and ids as well
mitron6
@mitron6
May 14 2017 05:03
@gaitchs @Lumexralph Wrong. NOT count = 0. Just dont do anything to count.
Ogundele Olumide
@Lumexralph
May 14 2017 05:03
@grfraser does the site have an API for developers?
@mitron6 showing him.... where it needs attention :wink:
Ogundele Olumide
@Lumexralph
May 14 2017 05:04
@mitron6 more like helping him see what you said
Steven
@LemonTruth
May 14 2017 05:04
function titleCase(str) {
  str = str.split(" ");
  var newArray = str.map(function(string){
    stringCapital = string.slice(0, 0).toUpperCase();
    stringEnd = string.slice(1).toLowerCase();
    string = stringCapital + stringEnd;
  });
  str = newArray.join(" ");
  return str;
}
the challenge is to write a function that can capitalize the first letter of every word in a string. I would appreciate some help.
mitron6
@mitron6
May 14 2017 05:04
@gaitchs Also you need to return the count and whether to Hold or Bet.
gaitchs gangmei
@gaitchs
May 14 2017 05:04
it will take a month
Mrdaniels3
@Mrdaniels3
May 14 2017 05:05
if (a> 0 || b> 0); return undefined; } abTest(); I think I am missing something here?
gaitchs gangmei
@gaitchs
May 14 2017 05:05
for me to figure out, anyway i will look into it later
Ogundele Olumide
@Lumexralph
May 14 2017 05:05
@LemonTruth you're not returning string from the map method callback
gaitchs gangmei
@gaitchs
May 14 2017 05:05
happy mothers day
mitron6
@mitron6
May 14 2017 05:05
@LemonTruth slice(0, 1)
Ogundele Olumide
@Lumexralph
May 14 2017 05:05
@Mrdaniels3 remove the ;
mitron6
@mitron6
May 14 2017 05:05
@LemonTruth But easier to just put a [0] after the variable name to get the first character.
@LemonTruth As in string[0]
Ogundele Olumide
@Lumexralph
May 14 2017 05:07
@Mrdaniels3 why do you guys like using if or for without curly braces, it doesn't help for readability though
Ogundele Olumide
@Lumexralph
May 14 2017 05:07
@Mrdaniels3 if (a> 0 || b> 0) return undefined;
@Mrdaniels3 ; terminates the statement and tells the interpreter to begin next line of code
Steven
@LemonTruth
May 14 2017 05:08
@mitron6 doesn't the string[0] only work for elements in an array?
mitron6
@mitron6
May 14 2017 05:08
@LemonTruth No, on a string you can use a subscript to select individual characters.
Steven
@LemonTruth
May 14 2017 05:09
@mitron6 woah, didn't know that
mitron6
@mitron6
May 14 2017 05:09
@LemonTruth But if you prefer to use slice, just remember that the second argument is the "up to but not including" index. So the first character is slice(0,1)
Ogundele Olumide
@Lumexralph
May 14 2017 05:10
@LemonTruth you're to return string in the callback of your map method, you're not returning anything
mitron6
@mitron6
May 14 2017 05:10
Good night everyone.
Steven
@LemonTruth
May 14 2017 05:11
@Lumexralph @mitron6 wow, thanks guys. you fixed me up pretty quickly
CamperBot
@camperbot
May 14 2017 05:11
lemontruth sends brownie points to @lumexralph and @mitron6 :sparkles: :thumbsup: :sparkles:
:cookie: 668 | @mitron6 |http://www.freecodecamp.com/mitron6
:star2: 1738 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
May 14 2017 05:12
@grfraser they've given you the illustration in jQuery
@mitron6 Good night
Mrdaniels3
@Mrdaniels3
May 14 2017 05:12
@Lumexralph Thank you
CamperBot
@camperbot
May 14 2017 05:12
mrdaniels3 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1739 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
May 14 2017 05:12
@kelechichinaka it's not loading here.... i don't know why
whats wrong with it?
Kelechi Chinaka
@ke1echi
May 14 2017 05:14
strange @Lumexralph
Mrdaniels3
@Mrdaniels3
May 14 2017 05:14
@Lumexralph I got a blank after I input the correct code, any ideas?
Kelechi Chinaka
@ke1echi
May 14 2017 05:14
function trueOrFalse(val){
  var falsy = new Boolean(false);
  if (val == falsy) {
    return "false";
  }
  else {
    return "true";
  }
}
what am i not doing well @Lumexralph
Ogundele Olumide
@Lumexralph
May 14 2017 05:15
@kelechichinaka don't create a boolean object using new
@kelechichinaka just do Boolean(val);
@kelechichinaka or
if(val) {
}
@kelechichinaka if also coerces values to boolean based on their truthy or falsy values
@Mrdaniels3 show your code
grfraser
@grfraser
May 14 2017 05:18
check out this @kelechichinaka
function bouncer(arr) {
  return arr.filter(*fill in the correct function(search mdn- a predefined function)*);
}
You have the words in your code
word*
Sulaiman
@suli-g
May 14 2017 05:18
@grfraser Instead of using input[type=submit] try using a div -- and then in your Javascript -- bind an on("click" function to that div which calls the getJSON function...
Kelechi Chinaka
@ke1echi
May 14 2017 05:18
val is supposed to check for falsy values @Lumexralph
grfraser
@grfraser
May 14 2017 05:19
@suli-g you can create buttons with div?
Ogundele Olumide
@Lumexralph
May 14 2017 05:19
@kelechichinaka i'll suggest
if(val)  return true;
else return false;
grfraser
@grfraser
May 14 2017 05:19
i guess using js you can huh
Ankur sharma
@ankur1163
May 14 2017 05:19
anyone know how to register nick on mirc
Mrdaniels3
@Mrdaniels3
May 14 2017 05:20
@Lumexralph if (a> 0 || b> 0) return undefined; abTest();
Sulaiman
@suli-g
May 14 2017 05:20
@grfraser well ... you could use a button element -- since it's easier to look at when someone checks your code... but I tend to use anything at this point since I'm not working for anyone yet...
deaninous
@deaninous
May 14 2017 05:20
how about return valfollowing from your previous pointer
Sulaiman
@suli-g
May 14 2017 05:21
@grfraser The problem with input[type=submit] is that it will reload your page and that's not a good thing unless your working with forms
Kelechi Chinaka
@ke1echi
May 14 2017 05:22
if(val) return true; else return false; throw more light on this @Lumexralph
Ogundele Olumide
@Lumexralph
May 14 2017 05:22
@kelechichinaka did it work?
Sulaiman
@suli-g
May 14 2017 05:22
@deaninous this won't work because some of the vals are Strings amongst other things
Ogundele Olumide
@Lumexralph
May 14 2017 05:23
@Mrdaniels3 what exactly is happening on FCC?
Kelechi Chinaka
@ke1echi
May 14 2017 05:23
yea @Lumexralph
buh looks strange to me @Lumexralph
Sulaiman
@suli-g
May 14 2017 05:23
Or you could try:
return val?true:false
Ogundele Olumide
@Lumexralph
May 14 2017 05:23
@kelechichinaka in JS there's implicit coercion and explicit coercion, some coercion happens implicitly in JS
Mrdaniels3
@Mrdaniels3
May 14 2017 05:23
@Lumexralph I get testing then nothing.
deaninous
@deaninous
May 14 2017 05:24
ha, thats interesting. @suli-g which exercise is it?
Ogundele Olumide
@Lumexralph
May 14 2017 05:24
@Mrdaniels3 did it indicate whether you passed the tests or failed any?
Sulaiman
@suli-g
May 14 2017 05:24

@deaninous referring to this?

Or you could try:
return val?true:false

Ogundele Olumide
@Lumexralph
May 14 2017 05:25
@kelechichinaka do you have an idea what coercion is ?
Mrdaniels3
@Mrdaniels3
May 14 2017 05:25
@Lumexralph no
Ogundele Olumide
@Lumexralph
May 14 2017 05:25
@Mrdaniels3 try reloading the page
Kelechi Chinaka
@ke1echi
May 14 2017 05:25
yea..was trying to do the explicit coercion @Lumexralph
deaninous
@deaninous
May 14 2017 05:25
yea @suli-g
Ogundele Olumide
@Lumexralph
May 14 2017 05:26
@kelechichinaka explicit coercion is good, it helps readability
Michael Cordero
@CyberPutty
May 14 2017 05:26
hey question regarding chunky monkey i solved it using a loop

   for (i=0; i<arr.length/size; i++) {
     newarr[i]= arr.slice(i*size,size*i+size);
grfraser
@grfraser
May 14 2017 05:26
why doesnt the mouse make it look like a button when hovered? ive seen other examples where the pointer changes when hovering over the div @suli-g
Michael Cordero
@CyberPutty
May 14 2017 05:26
but it says you can use push and slice , how would you solve this using push()
Ogundele Olumide
@Lumexralph
May 14 2017 05:26
@kelechichinaka you could do an explicit coercion by let booleanValue = Boolean(val);
Sulaiman
@suli-g
May 14 2017 05:27
@deaninous That's called Ternary notation... I learnt it on Codecademy which has nice Intro to (Many things) courses
Kelechi Chinaka
@ke1echi
May 14 2017 05:28
i still dont get it @Lumexralph
especially this your implicit code @Lumexralph
Sulaiman
@suli-g
May 14 2017 05:28
@grfraser you'll need to say that in your CSS
element:hover {
cursor:pointer;
}
grfraser
@grfraser
May 14 2017 05:28
what am i doing wrong?
Ogundele Olumide
@Lumexralph
May 14 2017 05:29
@kelechichinaka if(expression) whatever expression is there, it coerces it to it's truthy or falsy value, more like after coercion you either have if(true) the code will run or if(false) the code will not run, if runs when it's expresiion is boolean true after coercing it
grfraser
@grfraser
May 14 2017 05:29
submit isnt working as a button
deaninous
@deaninous
May 14 2017 05:29
so much to learn @suli-g
Kelechi Chinaka
@ke1echi
May 14 2017 05:30
oh i get it...thanks @Lumexralph
alanwucm111
@alanwu123
May 14 2017 05:30
how does var remainder works? for example the value of remainder should be 2. what should I put % , var remainder and numbers together?
grfraser
@grfraser
May 14 2017 05:31
i think codepen screwed my mouse up, its got two horizontal pointers all the time on that page
i really dont like that site lol
Ogundele Olumide
@Lumexralph
May 14 2017 05:31
@grfraser try check your browser console in your devTool
@kelechichinaka cool
grfraser
@grfraser
May 14 2017 05:31
lemme google that real quick not sure what devtool is
Ogundele Olumide
@Lumexralph
May 14 2017 05:31
@alanwu123 you remember how long division works ?
@grfraser developer tool in your browser
Sulaiman
@suli-g
May 14 2017 05:32
@grfraser Press F12
grfraser
@grfraser
May 14 2017 05:32
like debugger;
?
Ogundele Olumide
@Lumexralph
May 14 2017 05:32
@grfraser which browser are you using?
grfraser
@grfraser
May 14 2017 05:32
chrome
deaninous
@deaninous
May 14 2017 05:33
@grfraser you have not defined a listerner event
Kelechi Chinaka
@ke1echi
May 14 2017 05:33
function trueOrFalse(val){ if (val === false || val === 0 || val === -0 || val === "" || val === null || val === undefined || val === NaN){ return false; } else{ return true; } } this is what i wanted... off to church be right back @Lumexralph
grfraser
@grfraser
May 14 2017 05:33
@deaninous how would i do that? eventListener.something something i forget :(
Kelechi Chinaka
@ke1echi
May 14 2017 05:34
function trueOrFalse(val){
  if (val === false || val === 0 || val === -0 || val === "" 
  || val === null || val === undefined || val === NaN){
    return false;
  }
  else{
    return true;
  }
}
this is what i wanted... off to church be right back @Lumexralph
grfraser
@grfraser
May 14 2017 05:34
apis seem so cool. i would love to be able to understand them and use them
alanwucm111
@alanwu123
May 14 2017 05:34
@Lumexralph I'm a green hand . don't know what you mean.... var remainder a = 8 % 3 .. but it doesn't work...
grfraser
@grfraser
May 14 2017 05:34
@deaninous i have a click one
deaninous
@deaninous
May 14 2017 05:34
$("#button").click(console.log("button clicked") then check your console @grfraser
grfraser
@grfraser
May 14 2017 05:35
$(document).ready (function () {

  $('#submit').click(function () {

$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(a) {
  $("body").append(a[0].content + "<p>— " + a[0].title + "</p>")
});

  });

});
deaninous
@deaninous
May 14 2017 05:35
your are right @grfraser
grfraser
@grfraser
May 14 2017 05:35
not sure how to put the script in the html though? thats what I’m missing i think!
what link would i use? just the site?
deaninous
@deaninous
May 14 2017 05:35
a[0] is still notdefined @grfraser
Ogundele Olumide
@Lumexralph
May 14 2017 05:36
@alanwu123
4 / 3 = 1 rem 1
5 / 2 =  2 rem 1
7 / 5 = 1 rem 2
11 / 3 = 3 rem 2

what  % does is, it returns that remaining value after division so 
 4 % 3 = 1
5 % 2 = 1
7 % 5 = 2
11 % 3 = 2
grfraser
@grfraser
May 14 2017 05:36
it needs to be random not 0 right? @deaninous
Sulaiman
@suli-g
May 14 2017 05:36
@grfraser I think you're supposed to remove the callback= thing unless you're going to put a function name in there... Or would it work like that..
deaninous
@deaninous
May 14 2017 05:37
disregard everything. i said. @grfraser
grfraser
@grfraser
May 14 2017 05:37
@deaninous lol totally confused now
deaninous
@deaninous
May 14 2017 05:37
do console.log a and see what you get @grfraser
Ogundele Olumide
@Lumexralph
May 14 2017 05:37
@kelechichinaka that's long thing, you can even do this in your function, no need of the if condition return Boolean(val);
grfraser
@grfraser
May 14 2017 05:37
@suli-g are you sure?
@deaninous aight
Mrdaniels3
@Mrdaniels3
May 14 2017 05:37
@Lumexralph Had my > and < switched.
alanwucm111
@alanwu123
May 14 2017 05:37
@Lumexralph works I put an unne
Sulaiman
@suli-g
May 14 2017 05:38
console.log the response
grfraser
@grfraser
May 14 2017 05:38
console.log(what exactly?)
alanwucm111
@alanwu123
May 14 2017 05:38
@Lumexralph unnecessary a behind remainder..... thanks.
CamperBot
@camperbot
May 14 2017 05:38
alanwu123 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1740 | @lumexralph |http://www.freecodecamp.com/lumexralph
Sulaiman
@suli-g
May 14 2017 05:38
$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(a) {
console.log(JSON.stringify(a));
  $("body").append(a[0].content + "<p>— " + a[0].title + "</p>")
});
grfraser
@grfraser
May 14 2017 05:39
thank you @suli-g
CamperBot
@camperbot
May 14 2017 05:39
grfraser sends brownie points to @suli-g :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @suli-g |http://www.freecodecamp.com/suli-g
deaninous
@deaninous
May 14 2017 05:40
@grfraser make sure you got jqury
grfraser
@grfraser
May 14 2017 05:40
pen.js:1 Uncaught ReferenceError: $ is not defined
at pen.js:1
Sulaiman
@suli-g
May 14 2017 05:40
Yep you aren't using jQuery
grfraser
@grfraser
May 14 2017 05:40
i dont know how to insert it into the html doc, what link?
the sites url?
how do i use jquery?
Sulaiman
@suli-g
May 14 2017 05:41
go to settings
grfraser
@grfraser
May 14 2017 05:41
ah this is why i hate codepen
Ogundele Olumide
@Lumexralph
May 14 2017 05:41
@grfraser you're not alone
@alanwu123 :+1:
Sulaiman
@suli-g
May 14 2017 05:41
settings -> javascript then scroll to the bottom quick-add jQuery
grfraser
@grfraser
May 14 2017 05:42
added it and now
Mixed Content: The page at 'https://codepen.io/grfraser/pen/pPVBxM' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback='. This request has been blocked; the content must be served over HTTPS.
soooo what lol
is this a codepen issue
Sulaiman
@suli-g
May 14 2017 05:43
I normally do all my coding in Brackets
You're doing a cross-origin request
grfraser
@grfraser
May 14 2017 05:44
yeah i use brackets and sublime
normally
what is a cross-origin requiest
Sulaiman
@suli-g
May 14 2017 05:44
Change the JSON Url to https://crossorigin.me/http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=
grfraser
@grfraser
May 14 2017 05:45
yeah i tried that and
XMLHttpRequest cannot load https://crossorigin.me/http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=. The 'Access-Control-Allow-Origin' header contains multiple values '*, https://s.codepen.io', but only one is allowed. Origin 'https://s.codepen.io' is therefore not allowed access.
guesss that trick doesnt work anymroe
Sulaiman
@suli-g
May 14 2017 05:45
basically -- according to internet security standards, you can't use http to get https stuff
grfraser
@grfraser
May 14 2017 05:46
hmm back to basics- how am i connecting this to my html?
it isn’t?
Sulaiman
@suli-g
May 14 2017 05:46
When I had this problem, I just copied all the json from the original website to myjson.com and did the request to that link
grfraser
@grfraser
May 14 2017 05:47
i need to link <script src=“something.js"></script> dont i?
Sulaiman
@suli-g
May 14 2017 05:47
basically -- according to internet security standards, you can't use http to get https stuff
In relation to what cross-origin is
@grfraser nope.
grfraser
@grfraser
May 14 2017 05:48
is that bc codepen does is for me?
yeah i guess obviously lol duh me
okay so myjson.com...
i should paste the jquery there?
Sulaiman
@suli-g
May 14 2017 05:49
@grfraser yeah -- it's probably not the best help for beginners because imagine getting into a job and not putting in all the head stuff and scripts and things
@grfraser no -- go to the url you're using in getJSON
and copy everything to myjson.com (it basically helps us avoid the cross-origin bridge)
grfraser
@grfraser
May 14 2017 05:50
okay its a quote
but it only has one at a time
[{"ID":141,"title":"Jakob Nielsen","content":"<p>Consistency is one of the most powerful usability principles: when things always behave the same, users don&#8217;t have to worry about what will happen. Instead, they know what will happen based on earlier experience. <\/p>\n","link":"https:\/\/quotesondesign.com\/jakob-nielsen\/","custom_meta":{"Source":"<a href=\"http:\/\/www.useit.com\/alertbox\/9605.html\">article<\/a>"}}]
Sulaiman
@suli-g
May 14 2017 05:51
try: http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=20
h1tag
@h1tag
May 14 2017 05:51
isn't this called the mixed content error (when using http with https)?
Sulaiman
@suli-g
May 14 2017 05:52
@h1tag Oops - yes.
grfraser
@grfraser
May 14 2017 05:52
@suli-g you are smart man
Sulaiman
@suli-g
May 14 2017 05:53
@grfraser Nope. Just all my years of googling...
grfraser
@grfraser
May 14 2017 05:53
@suli-g haha why does it all appear on one line instead of nice formatting :(
nvm
after saving its pretty
Sulaiman
@suli-g
May 14 2017 05:54
:laughing:
grfraser
@grfraser
May 14 2017 05:54
$(document).ready (function () {

  $('#submit').click(function () {

$.getJSON("https://api.myjson.com/bins/1areyp", function(a) {
console.log(JSON.stringify(a));
  $("body").append(a[0].content + "<p>— " + a[0].title + "</p>")
});

  });

});
i used 40 instead of 20
but
VM2996 jquery.min.js:4 GET https://api.myjson.com/bins/1areyp net::ERR_INSECURE_RESPONSE
send @ VM2996 jquery.min.js:4
ajax @ VM2996 jquery.min.js:4
r.(anonymous function) @ VM2996 jquery.min.js:4
getJSON @ VM2996 jquery.min.js:4
(anonymous) @ VM2997 pen.js:5
dispatch @ VM2996 jquery.min.js:3
q.handle @ VM2996 jquery.min.js:3
honestly i dont remember learning all that much about jquery at fcc at all. just a short section
regardless, whats up with the error?
its https so im not understanding the insecure issue
grfraser
@grfraser
May 14 2017 06:00
@suli-g
Anurag Lahon
@anuraglahon16
May 14 2017 06:01

function factorialize(num) {
if(num>0){
num*=num;
num--;
}
return num;
}

factorialize(5);
how to factorise?

grfraser
@grfraser
May 14 2017 06:01
edit to add three `s on top and bottom
cmd enter to enter
this will format it nicely
@anuraglahon16
Anurag Lahon
@anuraglahon16
May 14 2017 06:02
@grfraser how to factorize
grfraser
@grfraser
May 14 2017 06:02
get rid of num--
change to num*=num-1
Anurag Lahon
@anuraglahon16
May 14 2017 06:03
whats wrong here ..it is multiplying the first num
Ogundele Olumide
@Lumexralph
May 14 2017 06:03
@anuraglahon16 you need a loop
grfraser
@grfraser
May 14 2017 06:03
sorry wait
loop it and num -= num
Ogundele Olumide
@Lumexralph
May 14 2017 06:03
@anuraglahon16 probably you wanted a while loop
grfraser
@grfraser
May 14 2017 06:04
@Lumexralph do you know why my codepen is not working now?
https://codepen.io/grfraser/pen/pPVBxM
Anurag Lahon
@anuraglahon16
May 14 2017 06:04
@Lumexralph lets try
grfraser
@grfraser
May 14 2017 06:05
@anuraglahon16 when adding code type three s before, then cmd shift for next line and paste code. make sure you cmd shift at the end to add three mores and then cmd enter to submit. this will format it nicely.
three `s *
three more`s*
left of the 1 key
@suli-g @Lumexralph @h1tag any ideas?
https://codepen.io/grfraser/pen/pPVBxM
on click of submit (in console)
GET https://api.myjson.com/bins/1areyp net::ERR_INSECURE_RESPONSE
send @ VM2996 jquery.min.js:4
ajax @ VM2996 jquery.min.js:4
r.(anonymous function) @ VM2996 jquery.min.js:4
getJSON @ VM2996 jquery.min.js:4
(anonymous) @ VM2997 pen.js:5
dispatch @ VM2996 jquery.min.js:3
q.handle @ VM2996 jquery.min.js:3
grfraser
@grfraser
May 14 2017 06:23
i just had to browse to the URL and accept the insecure page and it worked. now all the json data shows up in my console but how to display it randomly on the actual page?
@suli-g @Lumexralph @h1tag
Sulaiman
@suli-g
May 14 2017 06:25
@grfraser you can use Math.random()
Bob
@deadmanhide
May 14 2017 06:26
function lookUpProfile(firstName, prop){
// Only change code below this line
var answer;
for (var i=0; i<contacts.length; i++) {
if ((firstName === contacts[i].firstName) && (contacts[i].hasOwnProperty('prop'))) {
answer = contacts[i].prop;
} else if (firstName !== contacts[i].firstName) {
answer = "No such contact";
} else if (contacts[i].hasOwnProperty(prop) === false) {
answer = "No such property";
}}
return answer;
// Only change code above this line
}
anyone can help me in Profile Lookup?
grfraser
@grfraser
May 14 2017 06:27
@suli-g but how to display on page?
var item = items[Math.floor(Math.random()*items.length)];
and where to insert that?
Johnny
@JohnnyBizzel
May 14 2017 06:29
@grfraser Can I just check, are you asking, how to show a variable on a webpage?
grfraser
@grfraser
May 14 2017 06:30
from jquery yes
my code is
$(document).ready (function () {

  $('#submit').click(function () {

$.getJSON("https://api.myjson.com/bins/1areyp", function(a) {
a = items[Math.floor(Math.random()*items.length)];
console.log(JSON.stringify(a));
  $("body").append(a[0].content + "<p>— " + a[0].title + "</p>")
});

  });

});
which doesnt work
Johnny
@JohnnyBizzel
May 14 2017 06:31
@grfraser target an element and set either it's text or innerHTML property
grfraser
@grfraser
May 14 2017 06:31
well it works in the console
ah im not too familiar with those. i can look up innerHTML and text..? just text jquery?
Johnny
@JohnnyBizzel
May 14 2017 06:32
@grfraser start here http://api.jquery.com/html/
grfraser
@grfraser
May 14 2017 06:34
thats not innerHTML though, i know ive used it in a tutorial before. let me see..
something like
test = function() {
    var a = document.getElementById(‘quote');
    a.innerHTML = ‘';
}
or querySelector(‘quote’)?
xNamek
@xNamek
May 14 2017 06:38
can you be more specific on what is not working ? i
grfraser
@grfraser
May 14 2017 06:39
adding the quote from jquery api to webpage
@xNamek
https://api.myjson.com/bins/1areyp go there first and accept the insecure connection
otherwise it wont work
its only showing up in the console
like check your console and notice the random quotes. but how do i get them to display on the page?
xNamek
@xNamek
May 14 2017 06:42
thank you i am checking it out right now
grfraser
@grfraser
May 14 2017 06:43
@xNamek thank you!
CamperBot
@camperbot
May 14 2017 06:43
grfraser sends brownie points to @xnamek :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @xnamek |http://www.freecodecamp.com/xnamek
xNamek
@xNamek
May 14 2017 06:46
it seems that when accessing the JSON object that it returns "undefined"
for example : "JSON.stringify(a[0)]" returns undefined. It could be that you aren't accessing the JSON object correctly
grfraser
@grfraser
May 14 2017 06:47
it might have autosaved while i was experimenting. refresh and try one more time
it returns the quote and an error though
{"ID":465,"title":"Rastko Ciric","content":"<p>An inexperienced observer sees everything in a picture; the experienced one sees even the things that are missing.  </p>\n","link":"https://quotesondesign.com/rastko-ciric/"}
VM2997 pen.js:10 Uncaught TypeError: Cannot read property 'content' of undefined
    at Object.success (VM2997 pen.js:10)
    at i (VM2996 jquery.min.js:2)
    at Object.fireWith [as resolveWith] (VM2996 jquery.min.js:2)
    at A (VM2996 jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (VM2996 jquery.min.js:4)
but if the quote is in the console- i know i can get it on the webpage. its just… how?
xNamek
@xNamek
May 14 2017 06:50
I am tweaking your code right now hold on
grfraser
@grfraser
May 14 2017 06:50
thanks @xNamek !
CamperBot
@camperbot
May 14 2017 06:50
grfraser sends brownie points to @xnamek :sparkles: :thumbsup: :sparkles:
:warning: grfraser already gave xnamek points
grfraser
@grfraser
May 14 2017 06:51
its like im so close! anxious to see this api thing work for the first time ever.
xNamek
@xNamek
May 14 2017 06:51
i think i found out why
grfraser
@grfraser
May 14 2017 06:52
whys that?
xNamek
@xNamek
May 14 2017 06:52
When you are accessing the JSON object you are trying to access the index '0' when you should be accessing its properties instead
grfraser
@grfraser
May 14 2017 06:53
what would i replace 0 with?
xNamek
@xNamek
May 14 2017 06:53
for example instead of " a[0].content" you should use a["content"]
grfraser
@grfraser
May 14 2017 06:53
hmm let me see
same with title?
xNamek
@xNamek
May 14 2017 06:53
it worked in the console i'll let you check the display
yes
Vikram
@vikramnr
May 14 2017 06:53
hi all I'm setting up fcc in local but while mangodb i'm getting error
could anyone help me
grfraser
@grfraser
May 14 2017 06:54
still has an error.
:(
xNamek
@xNamek
May 14 2017 06:55
It worked!
grfraser
@grfraser
May 14 2017 06:55
oh wait
xNamek
@xNamek
May 14 2017 06:55
:)
try this for a test
$("body").append(a["content"] );
grfraser
@grfraser
May 14 2017 06:56
still an error, perhaps cause title?
xNamek
@xNamek
May 14 2017 06:56
yes change your title aswell
im still getting undefined :/
HeebieGeeBee
@HeebieGeeBee
May 14 2017 06:57
$("#quote").html(a.content + "<p>— " + a.title + "</p>") this will probably better
@grfraser
xNamek
@xNamek
May 14 2017 06:57
it is because when you access JSON objects you are supposed to use either Bracket notation or dot notation
HeebieGeeBee
@HeebieGeeBee
May 14 2017 06:58
instead of appending the body
xNamek
@xNamek
May 14 2017 06:58
you used both :)
so change a.['title'] to a['title]
oops i meant a["title"]
grfraser
@grfraser
May 14 2017 06:58
@HeebieGeeBee thanks let me try, pen is taking forever to reload
CamperBot
@camperbot
May 14 2017 06:58
grfraser sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1640 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
grfraser
@grfraser
May 14 2017 06:59
@xNamek i will try in a sec when pen loads
xNamek
@xNamek
May 14 2017 06:59
ok i tested it and it works just for reassurance
grfraser
@grfraser
May 14 2017 06:59
@xNamek thank you for the tips!
CamperBot
@camperbot
May 14 2017 06:59
grfraser sends brownie points to @xnamek :sparkles: :thumbsup: :sparkles:
:warning: grfraser already gave xnamek points
#OS
@horlabyc
May 14 2017 06:59
Pls help me debug this code

function palindrome(str) {
  // Good luck!
  var strNoAlphaNum = str.replace(/[^0-9a-z]/gi,'');
  var strLower = strNoAlphaNum.toLowerCase();
  var newStr = "";
  var out; var j = 0;
  for (var i=strLower.length ; i<= 0; i--){
          newStr[i] += strLower[j];
      j++;
  }
 // if (newStr == strLower){
  //   out= true;
  //}
 // else {
  //   out = false;
 // }
  return newStr;
}



palindrome("jyeyo");
grfraser
@grfraser
May 14 2017 07:00
it seems like it doesnt want to load now lol
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:00
@horlabyc your for loop is a mess
xNamek
@xNamek
May 14 2017 07:01
your i <= 0 should be the other way around
#OS
@horlabyc
May 14 2017 07:01
@HeebieGeeBee i can see that, but I'm kinda stuck
xNamek
@xNamek
May 14 2017 07:01
change it to " i >= 0" @horlabyc
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:01
there is also an much easier method for reversing strings
xNamek
@xNamek
May 14 2017 07:02
@grfraser did it work for you?
#OS
@horlabyc
May 14 2017 07:02
@xNamek >= 0?
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:02
@horlabyc split the string into an array reverse the array and the join it
and the methods can be chained like str = str.split('').reverse().join('');
xNamek
@xNamek
May 14 2017 07:03
test
check
how do you format your message for
code on this chat?
grfraser
@grfraser
May 14 2017 07:04
@xNamek creating a new one bc it wont load anymore one min
three `s on top
three `s on bottom
xNamek
@xNamek
May 14 2017 07:04
'''s
CamperBot
@camperbot
May 14 2017 07:04
:bulb: to format code use backticks! ``` more info
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:04
@horlabyc but if youre gonna stick with that weird loop it needs to be var i = strLower.length - 1 too
grfraser
@grfraser
May 14 2017 07:04
no the one to the left of the 1 key
cmd enter to submit
xNamek
@xNamek
May 14 2017 07:05
this is a test
grfraser
@grfraser
May 14 2017 07:05
hell yes @xNamek
xNamek
@xNamek
May 14 2017 07:05
@grfraser what ??
grfraser
@grfraser
May 14 2017 07:05
you did it lol
one sec for my issue
old pen just broke, won’t load. making new one
xNamek
@xNamek
May 14 2017 07:06
oh haha yeah thanks @grfraser and how do you send brownies?
CamperBot
@camperbot
May 14 2017 07:06
xnamek sends brownie points to @grfraser :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @grfraser |http://www.freecodecamp.com/grfraser
grfraser
@grfraser
May 14 2017 07:06
no JS error message for you?
you just mention and say thank you or ty or thanks haha
i guess you cant edit my pen huh
xNamek
@xNamek
May 14 2017 07:07
lol awesome , and no JS errors for me
@grfraser let me try
#OS
@horlabyc
May 14 2017 07:07

function palindrome(str) {
// Good luck!
var strNoAlphaNum = str.replace(/[^0-9a-z]/gi,'');
var strLower = strNoAlphaNum.toLowerCase();
var newStr = "";
var out ; var j = 0;
for (var i=strLower.length-1 ; i>= 0; i--){
newStr += strLower[i];

}
if (newStr == strLower){
out= true;
}
else {
out = false;
}
return out;
}

palindrome("eye");

function palindrome(str) {
  // Good luck!
  var strNoAlphaNum = str.replace(/[^0-9a-z]/gi,'');
  var strLower = strNoAlphaNum.toLowerCase();
  var newStr = "";
  var out ; var j = 0;
  for (var i=strLower.length-1 ; i>= 0; i--){
          newStr += strLower[i];

  }
  if (newStr == strLower){
    out= true;
  }
  else {
     out = false;
 }
  return out;
}



palindrome("eye");
This worked
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:08
@horlabyc you can just do return newStr === strLower
no need for tha if statement and extra variable
#OS
@horlabyc
May 14 2017 07:08
@HeebieGeeBee i decide to use the for loop decrement method
xNamek
@xNamek
May 14 2017 07:09
@grfraser i found why your codepen isn't working
**loading
  $("body").append(a["content"]  + "<p>— " + a[title] + "</p>");
replace your body append snippet with mine
  $("body").append(a["content"]  + "<p>— " + a["title"] + "</p>");
@HeebieGeeBee thanks for the lookout!
CamperBot
@camperbot
May 14 2017 07:11
xnamek sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1641 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:12
and appending to the body isnt good anyways, you just gonna end up with a list of quotes at the bottom of the page
xNamek
@xNamek
May 14 2017 07:13
@HeebieGeeBee i agree
his issue was getting it to display in the first place which is what we had to solve first
grfraser
@grfraser
May 14 2017 07:13
@HeebieGeeBee @xNamek true, i keep getting errors in the js section of codepen though
HeebieGeeBee
@HeebieGeeBee
May 14 2017 07:14
you can just fork that ^ @grfraser
grfraser
@grfraser
May 14 2017 07:14
@HeebieGeeBee that solved the errors but no more quotes in the console
xNamek
@xNamek
May 14 2017 07:14
@replace your html append code
with @HeebieGeeBee
grfraser
@grfraser
May 14 2017 07:14
i just copied and pasted thank you sir @HeebieGeeBee
CamperBot
@camperbot
May 14 2017 07:14
grfraser sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: grfraser already gave heebiegeebee points
xNamek
@xNamek
May 14 2017 07:15
awesome!! :D