These are chat archives for FreeCodeCamp/HelpJavaScript

1st
Nov 2016
Jenny
@jenny0325
Nov 01 2016 00:00
sorry wrong chat
Masaomi Pikachu
@MasaomiPikachu
Nov 01 2016 00:00
why the +1? @RyWilliams
Ryan
@ryan-jd
Nov 01 2016 00:00
@adeldennaoui you can either click the run tests button or shortcut is ctrl + enter (whilst cursor is inside code)
Masaomi Pikachu
@MasaomiPikachu
Nov 01 2016 00:01
is that so the range begins at 1 rather than 0? @RyWilliams
Ryan Williams
@RyWilliams
Nov 01 2016 00:01
yup
Masaomi Pikachu
@MasaomiPikachu
Nov 01 2016 00:01
ahhh so it does make sense. lol thanks a bunch @RyWilliams
CamperBot
@camperbot
Nov 01 2016 00:01
masaomipikachu sends brownie points to @rywilliams :sparkles: :thumbsup: :sparkles:
:cookie: 310 | @rywilliams |http://www.freecodecamp.com/rywilliams
Emily Sperry
@sperrye
Nov 01 2016 00:01
It seems like the JavaScript lessons got really hard really fast... I was going at a good pace and now I'm dying
Ryan Williams
@RyWilliams
Nov 01 2016 00:01
also math.floor rounds down, so if you're trying to get a number between 1-6 you'll never get 6
without the +1
marzelin
@marzelin
Nov 01 2016 00:01
@MasaomiPikachu this part (max - min + 1) is for range. By default Math.random has values between 0 and 1. You can extend the range by multiplying it by some number, ie 10. It results with values from 0 to 10 (10 different values from 0 to 9). The min at the end moves the possible values. If min is 1 and range is 10, you get values from 1 to 10.
Jeff Shapiro
@Jeff-Shapiro
Nov 01 2016 00:02
@sperrye too comfy too quick
Emily Sperry
@sperrye
Nov 01 2016 00:03
@Jeff-Shapiro I suppose. The assignments got a lot more complex, which I expected. It just seemed to happen over one or two lessons. FCC quit holding my hand
Masaomi Pikachu
@MasaomiPikachu
Nov 01 2016 00:03
yep that all makes sense. thanks for all the help @RyWilliams @dkweonlee
CamperBot
@camperbot
Nov 01 2016 00:03
masaomipikachu sends brownie points to @rywilliams and @dkweonlee :sparkles: :thumbsup: :sparkles:
:cookie: 167 | @dkweonlee |http://www.freecodecamp.com/dkweonlee
:warning: masaomipikachu already gave rywilliams points
Aaron Bell
@awb715
Nov 01 2016 00:03
anyone working on weather app? the api doesnt give info about the state your town is in
Ryan Williams
@RyWilliams
Nov 01 2016 00:03
@dkweonlee need to capitalize the m in My
Walid Ashri
@walidashri
Nov 01 2016 00:03
@dkweonlee only typo in var name
Jeff Shapiro
@Jeff-Shapiro
Nov 01 2016 00:03
@sperrye its cause it actually started to make you build a logic and not just use a function
Ryan Williams
@RyWilliams
Nov 01 2016 00:04
@MasaomiPikachu No problem!
Daniel Kweon-lee
@dkweonlee
Nov 01 2016 00:05
@RyWilliams @walidashri Thank you!
CamperBot
@camperbot
Nov 01 2016 00:05
dkweonlee sends brownie points to @rywilliams and @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 539 | @walidashri |http://www.freecodecamp.com/walidashri
:cookie: 311 | @rywilliams |http://www.freecodecamp.com/rywilliams
Ryan
@ryan-jd
Nov 01 2016 00:05
@MasaomiPikachu the +1 is because math.floor rounds down to nearest integer. Therefore you could still get zero e.g. If min is 0 and max is 1 then if math.rand spits out between 0 and 0.5 you will return 0, if it spits out between 0.5 and 1 you will return 1
Walid Ashri
@walidashri
Nov 01 2016 00:06
@sperrye No pain No gain :)
Ryan
@ryan-jd
Nov 01 2016 00:07
@awb715 do you mean state as in US state? I used a separate API to get location, think it was www.ip-API.com
@awb715 I then used the coordinates from that to feed to open weather
Aaron Bell
@awb715
Nov 01 2016 00:10
hmm okay
thanks @ryan-jd
CamperBot
@camperbot
Nov 01 2016 00:12
awb715 sends brownie points to @ryan-jd :sparkles: :thumbsup: :sparkles:
:cookie: 329 | @ryan-jd |http://www.freecodecamp.com/ryan-jd
Ryan
@ryan-jd
Nov 01 2016 00:12
@awb715 no problem, let me know if you need more help
@awb715 if you call 'http://ip-api.com/json' then json.regionName will give you the state
Aaron Bell
@awb715
Nov 01 2016 00:15
@ryan-jd
$.ajax({
    url:"http://ip-api.com/json",
    dataType:"jsonp",
    success:function(loc){
     var loc=loc.city+", "+ loc.regionName + loc.country;
      $("#location").html(location);
      console.log(loc);
    }
  })
doesnt work or come up in the console
Emily Sperry
@sperrye
Nov 01 2016 00:17
:crying_cat_face:
Walid Ashri
@walidashri
Nov 01 2016 00:22
@awb715 why 2 location func?
Aaron Bell
@awb715
Nov 01 2016 00:23
well if you read up, weather api doesnt have state and country
so the first location is for that
the 2ndis for weather
Ryan
@ryan-jd
Nov 01 2016 00:23
@awb715 shouldn't data type be Json? (No p)?
Aaron Bell
@awb715
Nov 01 2016 00:25
still doesnt work @ryan-jd
Walid Ashri
@walidashri
Nov 01 2016 00:26
@awb715 let me get it u need coordinates for weather api call?
and u need to show city and country so use what u get from geolocation()
Aaron Bell
@awb715
Nov 01 2016 00:27
yea
Walid Ashri
@walidashri
Nov 01 2016 00:27
and btw it's working for me
Aaron Bell
@awb715
Nov 01 2016 00:27
loc is working?
Walid Ashri
@walidashri
Nov 01 2016 00:28
yes add the proxy link
Adel
@AdelMahjoub
Nov 01 2016 00:28
@awb715 geoloc works only on https, and ip-api only on http, trouble
Aaron Bell
@awb715
Nov 01 2016 00:28
so add cross origon to ip-api?
Walid Ashri
@walidashri
Nov 01 2016 00:28
@awb715 yes
Adel
@AdelMahjoub
Nov 01 2016 00:29
@awb715 no, it will provide the server ip
Ryan
@ryan-jd
Nov 01 2016 00:29
yeah @awb715 if you open chrome developer tools it says that http is insecure. you cant call https on ip-api as it doesnt have it, i got round it by using fetch instead of ajax
Aaron Bell
@awb715
Nov 01 2016 00:29
nowit works
the http/https
that stuff is a little over my head
Walid Ashri
@walidashri
Nov 01 2016 00:30
but as @AdelMahjoub said not the right info
Adel
@AdelMahjoub
Nov 01 2016 00:30
@awb715 if you add https://crossorigin.me/ in front of ip-api it should return crossorigin.me ip not the user one
Aaron Bell
@awb715
Nov 01 2016 00:31
i got it
Adel
@AdelMahjoub
Nov 01 2016 00:31
@awb715 openweather api provides city and country , what are looking for ?
Ryan
@ryan-jd
Nov 01 2016 00:31
@awb715 look in to using chrome dev tools - when i ran your code the console says this which found the issue: The page at 'https://codepen.io/Aaron-w-Bell/pen/LRKRQJ?editors=0011' was loaded over HTTPS, but requested an insecure script 'http://ip-api.com/json?callback=jQuery31005342174877617212_1477960278796&_=1477960278797'. This request has been blocked; the content must be served over HTTPS.

@awb715 i wouldnt recommend using crossorigin though, in my experience it slows down the more times you call the code, i used fetch, this was my code:

function getMyLocation() {
  var location = {};
  location.ipCoordinates = [];
  // fetch location JSON from IP address API
  return fetch('http://ip-api.com/json')
  .then(function connectToJSON(response) {
    if (response.status >= 200 && response.status < 400) {
      return response.json();
    }
    else {
      console.log(response.status);
      errorReceived(err);
      return false;
    }
  }).then(function getLocation(json) {
    location.ipCoordinates[0] = json.lat;
    location.ipCoordinates[1] = json.lon;
    location.country = json.country;
    location.city = json.city;
    // return coordinates and country/city
    return location;
  }).catch(function (err) {
    errorReceived(err);
    console.log('getMyLocation() failed');
    return false;
  });
}

make sure you include a polyfill in the head of your html:

<!-- fetch polyfill -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.js"></script>
note that fetch is asynchronous
fetch also means that you dont have to use jquery
livih09
@livih09
Nov 01 2016 00:37
Hey guys I need help on "Testing Objects for Properties" if anyone is up for it.
Walid Ashri
@walidashri
Nov 01 2016 00:39
@livih09 ?
livih09
@livih09
Nov 01 2016 00:40
@walidashri did you look at the section?
@walidashri or what's the ? for
Walid Ashri
@walidashri
Nov 01 2016 00:40
@livih09 yes what is the prob
livih09
@livih09
Nov 01 2016 00:41

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

}

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

@walidashri I don't really understand this
Aaron Bell
@awb715
Nov 01 2016 00:42
i have to learn that @ryan-jd
Walid Ashri
@walidashri
Nov 01 2016 00:43
@livih09 this line is not right in syntax if(myObj.hasOwnProperty(checkProp === true))
why isnt my html appearing ina row?
livih09
@livih09
Nov 01 2016 00:44
@walidashri I thought that might be a prob. Is it [] that I'm supposed to use for the property?
Walid Ashri
@walidashri
Nov 01 2016 00:45
@livih09 No () is right. something else
Adel
@AdelMahjoub
Nov 01 2016 00:46
@awb715 <div> has display:block by default
Walid Ashri
@walidashri
Nov 01 2016 00:46
@livih09 if(myObj.hasOwnProperty(checkProp) === true)
one of them is not in right place
livih09
@livih09
Nov 01 2016 00:47
@walidashri wow I see it lol can't believe I missed that thanks!
CamperBot
@camperbot
Nov 01 2016 00:47
livih09 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 540 | @walidashri |http://www.freecodecamp.com/walidashri
Aaron Bell
@awb715
Nov 01 2016 00:47
so dont put that info in a div? @AdelMahjoub
Adel
@AdelMahjoub
Nov 01 2016 00:48
@awb715 add a rule for the two id, display: inline-block
jrr5230
@jrr5230
Nov 01 2016 00:52
Hey guys I still have the same issue as before...How do I output both the count and the string

var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count -= 1;
break;

}

console.log(count);

if(count > 0){
return " Bet";
}
else if (count <= 0){
return " Hold";
}
// Only change code above this line
}

Ryan Williams
@RyWilliams
Nov 01 2016 00:53
@jrr5230 return 'some string ' + var
Walid Ashri
@walidashri
Nov 01 2016 00:53
@jrr5230 return count + the string watch for the spacing ;)
jrr5230
@jrr5230
Nov 01 2016 00:54
ohh sweet I forgot about concatenating lol
Aaron Bell
@awb715
Nov 01 2016 00:54
  $("#temp").html(far + "&deg");
      $("temp").click(function(){
       $("temp").html(celc +"&deg");
      });
does that make sense?
Marcin
@marpolbr
Nov 01 2016 00:57
@awb715 stupid question. How to add code in the same way like you?
Is it a picture?
Walid Ashri
@walidashri
Nov 01 2016 00:58
@marpolbr ''' check this :point_down:
CamperBot
@camperbot
Nov 01 2016 00:58
:bulb: to format code use backticks! ``` more info
LydaTech
@lydatech
Nov 01 2016 00:58
@marpolbr earn to paste your code in chat by reading this link: How To Share Your Code In Chat
It makes it easier for everyone to review your code and give you the help you are looking for! Also please remember to mention the TITLE of the challenge, NOT any numbers you see...
Basically type 3 back ticks ``` hit enter then paste your code. When you're ready to send it, hit CTRL+ENTER together
@walidashri that link doesnt work any longer
Walid Ashri
@walidashri
Nov 01 2016 00:59
@lydatech thanks good to know
CamperBot
@camperbot
Nov 01 2016 00:59
walidashri sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 1364 | @lydatech |http://www.freecodecamp.com/lydatech
Marcin
@marpolbr
Nov 01 2016 01:00
Thank you so much
Walid Ashri
@walidashri
Nov 01 2016 01:00
@awb715 what do u mean ?
trying to makethe temp number clickable
Adel
@AdelMahjoub
Nov 01 2016 01:02
@awb715 add # on the selector, but it will only work once
Walid Ashri
@walidashri
Nov 01 2016 01:02
@awb715 missing some # :)
Aaron Bell
@awb715
Nov 01 2016 01:03
wow
lol
the son of god
@the-god-of-son
Nov 01 2016 01:05
i have a question
myVar = myVar ++;
myVar = myVar ++;
why this wrong?
solar95
@solar95
Nov 01 2016 01:08
you can't do myVar++ in javascript
instead you can use
+=1
so your code should be something like
myVar = (myVar+=1)
or
myVar+=1
Stephen James
@sjames1958gm
Nov 01 2016 01:09
@solar95 myVar++ is valid js
@the-god-of-son you should have myVar++ by itself
@the-god-of-son myVar = myVar++; this will increment myVar, but then assign the original myVar back to myVar so it doesn't change
the son of god
@the-god-of-son
Nov 01 2016 01:11
thank you,let me see
Aaron Bell
@awb715
Nov 01 2016 01:12
@AdelMahjoub trying to figure out a way to keep it constant clicking. dont give me the answer!

        if($("#temp"===far + "&deg Fahrenheit")){
        $("#temp").html(celc + "&deg Celcius");}
        else{
                $("#temp").html(far + "&deg Fahrenheit");

        }
didnt work
Adel
@AdelMahjoub
Nov 01 2016 01:13
@awb715 meh, you are overthinking
the son of god
@the-god-of-son
Nov 01 2016 01:14
@sjames1958gm we should how change?
Aaron Bell
@awb715
Nov 01 2016 01:14
haha =(
Stephen James
@sjames1958gm
Nov 01 2016 01:14
@the-god-of-son You replace myVar = myVar + 1 with myVar++
Marcin
@marpolbr
Nov 01 2016 01:15
I got a problem in "Record Collection" exercise.

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

      if (collection[id][prop].hasOwnProperty(prop)){
        collection[id][prop].push(value);
      }
      else{
        collection[id][prop] = [];
        collection[id][prop].push(value);
      }


  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Aaron Bell
@awb715
Nov 01 2016 01:15
should i toggle over an array? @AdelMahjoub
the son of god
@the-god-of-son
Nov 01 2016 01:15
@sjames1958gm they sey must use ++
Stephen James
@sjames1958gm
Nov 01 2016 01:15
@marpolbr You aren't making the checks asked for by instructions.
Adel
@AdelMahjoub
Nov 01 2016 01:15
@awb715 search for .toggle()
Stephen James
@sjames1958gm
Nov 01 2016 01:16
@the-god-of-son Yes.
Replace
myVar = myVar + 1
with
myVar++
Marcin
@marpolbr
Nov 01 2016 01:17
@sjames1958gm I want to check "hasOwnProperty" function, but i got an error "TypeError: Cannot read property 'hasOwnProperty' of undefined"
Stephen James
@sjames1958gm
Nov 01 2016 01:17
@marpolbr Why would the property have the property prop - collection[id] might have the property but not collection[id][prop]
@marpolbr But you need to test if value !== " as per the instructions
Marcin
@marpolbr
Nov 01 2016 01:18
@sjames1958gm ouch, thank you
CamperBot
@camperbot
Nov 01 2016 01:18
marpolbr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4112 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 01:18
@marpolbr :+1:
the son of god
@the-god-of-son
Nov 01 2016 01:18
@sjames1958gm thank you very much
CamperBot
@camperbot
Nov 01 2016 01:18
the-god-of-son sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4113 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 01:19
@the-god-of-son :+1:
the son of god
@the-god-of-son
Nov 01 2016 01:19
lol
Adel
@AdelMahjoub
Nov 01 2016 01:21
@awb715 btw the country is not accurate, because of crossorigin.me is in New York, so it always shows New York
@awb715 in openweather api response the country is under .sys.country, the city under .name
Aaron Bell
@awb715
Nov 01 2016 01:24
okay
Joseph
@revisualize
Nov 01 2016 01:25
@solar95 You can do myVar++; in JS
scott phothisane
@PkkerScott
Nov 01 2016 01:26
blob
hey everyone so can someone help explain that to me
@PkkerScott // How do you add a number (item) to the end of an array (arr)? What does this method return?
@PkkerScott // How do you remove the first element from an array (arr)? What does this method return?
I need to research:
Kolmogorov complexity
invariance theorem
hyperasymptotic approximations
Aaron Bell
@awb715
Nov 01 2016 01:29
$("#temp").toggle({$("#temp").html(celc + "&deg Celcius"),{$("#temp").html(celc + (far + "&deg Fahrenheit"));
@AdelMahjoub
not wokring haha
Adel
@AdelMahjoub
Nov 01 2016 01:31
@awb715 told you you are overthinking, you read about toggle() ?
Aaron Bell
@awb715
Nov 01 2016 01:31
yes
Adel
@AdelMahjoub
Nov 01 2016 01:35
@awb715 stick to your solution
$("#temp").click(function(e) {
        if($(this).text() == (far + "°F")) $(this).text(celc + "°C");
         else $(this).text(far + "°F");
      });
@awb715 and try to fix the country, it all ways shows US, NewYork
Aaron Bell
@awb715
Nov 01 2016 01:36
ok, im focusin on the toggle
im stuck tho
the son of god
@the-god-of-son
Nov 01 2016 01:37
hello,somebody know how change github name?
Adel
@AdelMahjoub
Nov 01 2016 01:37
@awb715 maybe not the best example to use toggle
scott phothisane
@PkkerScott
Nov 01 2016 01:39
@revisualize thank you, i understand it in my head, but if i had to explain it to someone, i think i would confuse them and myself
CamperBot
@camperbot
Nov 01 2016 01:39
pkkerscott sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2160 | @revisualize |http://www.freecodecamp.com/revisualize
Joel Fishel
@jelous1
Nov 01 2016 01:40
Hi, having a little trouble getting my weather challenge going. I really don't see where the problem might be - would be amazing if someone could help. Here's the codepen http://codepen.io/jelous1/pen/yamJPr
Adel
@AdelMahjoub
Nov 01 2016 01:41
@jelous1 lat is out of scope
Aaron Bell
@awb715
Nov 01 2016 01:42
@AdelMahjoub

$("#temp").toggle(function(){$("#temp").html(far + "&deg Fahrenheit");},function(){$("#temp").html(celc + "&deg Fahrenheit");}
Joel Fishel
@jelous1
Nov 01 2016 01:43
@AdelMahjoub Quite a new coder so not entirely sure how I can get it in scope?? I thought I called the function getWeather() and so the variables then existed in scope
getCoords even
Adel
@AdelMahjoub
Nov 01 2016 01:45
@jelous1 you defined lat and long in getCoord function,
Joel Fishel
@jelous1
Nov 01 2016 01:45
@AdelMahjoub yes, does executing getCoord() in the getWeather() function not bring the variables from getCoord() into it?
Adel
@AdelMahjoub
Nov 01 2016 01:46
@jelous1 they are local variables, cannot be read by another function
Joel Fishel
@jelous1
Nov 01 2016 01:46
@AdelMahjoub aww :( so I have to make 1 big ugly function to do it all at once? I can't split it into steps?
Adel
@AdelMahjoub
Nov 01 2016 01:47
@jelous1 you can split it into pieces
Joel Fishel
@jelous1
Nov 01 2016 01:50
@AdelMahjoub how so? I need a little more guidance, I'm quite new to all of this - how can I create functions that give variables which I can then call upon in my later functions?
@AdelMahjoub Oh maybe they don't need to be functions at all...
Casey Pierce
@caseyrp365
Nov 01 2016 01:51
Hello everyone. I was wondering if anyone had any suggestions where I could find additional reading for JavaScript? I'm struggling through most of the lessons...It's just not clicking.
Joel Fishel
@jelous1
Nov 01 2016 01:52
@caseyrp365 w3schools.com is fantastic!
Aaron Bell
@awb715
Nov 01 2016 01:52
@AdelMahjoub any good readings on toggle.
it says jquery mightve got rid ofit
Casey Pierce
@caseyrp365
Nov 01 2016 01:53
@jelous1 thank you! I will check in to it.
CamperBot
@camperbot
Nov 01 2016 01:53
caseyrp365 sends brownie points to @jelous1 :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @jelous1 |http://www.freecodecamp.com/jelous1
Joel Fishel
@jelous1
Nov 01 2016 01:55
@AdelMahjoub I suppose if I make the function getLong and getLat and make them return the respective long and lat values then I can use them in other functions?
Marcin
@marpolbr
Nov 01 2016 01:55
@caseyrp365 Also check this if you want https://github.com/getify/You-Dont-Know-JS
Tom
@moT01
Nov 01 2016 01:56
@jelous1 try declaring the variables outside the functions
Adel
@AdelMahjoub
Nov 01 2016 01:57
@jelous1 as you like, global variables works too
Tom
@moT01
Nov 01 2016 01:57
anyone want to help me with my wiki viewer?
Casey Pierce
@caseyrp365
Nov 01 2016 01:59
@marpolbr thanks! I will also read up there as well.
CamperBot
@camperbot
Nov 01 2016 01:59
caseyrp365 sends brownie points to @marpolbr :sparkles: :thumbsup: :sparkles:
:cookie: 211 | @marpolbr |http://www.freecodecamp.com/marpolbr
ZhouLiang
@1282772905
Nov 01 2016 01:59
function mutation(arr) {
  var str=arr[1];
  for(i=0;i<arr[1].length-1;i++){
    if(arr[0].indexOf(str.chartAt(i))){
      return true;
    }else{
      return false;
    }
  }
}

mutation(["hello", "hey"]);//uh......How to do this question?
Aaron Bell
@awb715
Nov 01 2016 02:00
thats a fun one @1282772905 read the documentation that it tells you to read carefully
Joel Fishel
@jelous1
Nov 01 2016 02:01
Hi guys, I've updated the code to make the important variables global but I'm still not getting anything out of it: http://codepen.io/jelous1/pen/yamJPr
@AdelMahjoub thank you for the help so far tho!
CamperBot
@camperbot
Nov 01 2016 02:01
jelous1 sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
Adel
@AdelMahjoub
Nov 01 2016 02:02
@jelous1 use https for geoloc,
Joel Fishel
@jelous1
Nov 01 2016 02:02
@AdelMahjoub what's https? and what's wrong with the method i've used? It's what they show us in the freecodecamp tutorials
Aaron Bell
@awb715
Nov 01 2016 02:03
 $("#temp").click(function(){
       $("#temp").toggle($("#temp").html(far + "&deg Farenheight"),$("#temp").html(celc + "&deg Celcius")) 
      ;}
this is onlychanging once
Tom
@moT01
Nov 01 2016 02:03
@jelous1 i dont see any global vars
Joel Fishel
@jelous1
Nov 01 2016 02:04
@moT01 how do you declare a global variable? I thought you just did e.g. globalVar = "somestring"
Tom
@moT01
Nov 01 2016 02:04
by your api key
put var lat;
var lon
et
c
the assign values later
then*
Joel Fishel
@jelous1
Nov 01 2016 02:04
@moT01 that's what I did first time round -.- that's not a global var is it?
@moT01 ohh you mean outside the function
@moT01 and then append the answer in when in some function?
Tom
@moT01
Nov 01 2016 02:05
value, yes
your console.log is very useful for debugging
Luke
@TheGenieOfTruth
Nov 01 2016 02:07
I'm on the Drop it challenge and I don't understand why this isn't working...
function dropElements(arr, func) {
  for(i=0;i<arr.length;i++){
    if(func(arr[i])){ 
      i = arr.length;
    }
    arr.shift();
  }
  return arr;
}
Joel Fishel
@jelous1
Nov 01 2016 02:07
@moT01 thank you, I'll try it
CamperBot
@camperbot
Nov 01 2016 02:07
jelous1 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @mot01 |http://www.freecodecamp.com/mot01
Aaron Bell
@awb715
Nov 01 2016 02:08
@AdelMahjoub
   $("#temp").click(function(){
       $("#temp").toggle($("#temp").html(far + "&deg Farenheight"),$("#temp").html(celc + "&deg Celcius")) 
      ;}
Adel
@AdelMahjoub
Nov 01 2016 02:10
@awb715 you already have a solution lol, why insisting in using toggle ,
Luke
@TheGenieOfTruth
Nov 01 2016 02:11
Anyone gonna help me...? All hung up on this JQuery toggle stuffs
Aaron Bell
@awb715
Nov 01 2016 02:11
ok
Tom
@moT01
Nov 01 2016 02:11
i was looking @TheGenieOfTruth kind of
Luke
@TheGenieOfTruth
Nov 01 2016 02:11
aye
Tom
@moT01
Nov 01 2016 02:11
im not that far yet
Luke
@TheGenieOfTruth
Nov 01 2016 02:14
Resolved
comaeternal
@comaeternal
Nov 01 2016 02:14
I'm having a hard time understanding this concept. I had to google the solution after days of working on this. I wrote my notes in the code, but I want to make sure it's correct. If anyone can help. thanks

function confirmEnding(str, target) {
  return (str.substr(-target.length) === target);
}
//target.length will output the entire string or in this case "N". It will then match "N" with //the characters at the end of str.substr. This it will check to see if this matches with the //argument target..

confirmEnding("Bastian", "n");
Tom
@moT01
Nov 01 2016 02:15
show @TheGenieOfTruth
Luke
@TheGenieOfTruth
Nov 01 2016 02:15
Why?
You'll get to it
Aaron Bell
@awb715
Nov 01 2016 02:15
@AdelMahjoub canyou explainthe this
Tom
@moT01
Nov 01 2016 02:15
curious, cause i was looking
Luke
@TheGenieOfTruth
Nov 01 2016 02:16
Not handing out my hard earned google m9
Aaron Bell
@awb715
Nov 01 2016 02:16
@ad
@AdelMahjoub you cant even use toggle for this
Tom
@moT01
Nov 01 2016 02:16
theres answers to find if i want em
just search for them
well whatever, you wanna solve my problem for me
Joseph
@revisualize
Nov 01 2016 02:16
@comaeternal That's correct.
comaeternal
@comaeternal
Nov 01 2016 02:17
@revisualize thanks
CamperBot
@camperbot
Nov 01 2016 02:17
comaeternal sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2161 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 01 2016 02:19
@comaeternal Do you understand what the code does?
Tom
@moT01
Nov 01 2016 02:20
http://codepen.io/moT01/pen/LRoxrQ?editors=1011
my getwiki() inside where i get my form info doesn't run js line 52
Adel
@AdelMahjoub
Nov 01 2016 02:20
@awb715 you have a solution, forget about toggle for now
$("#temp").click(function(e) {
        if($(this).text() == (far + "°F")) $(this).text(celc + "°C");
         else $(this).text(far + "°F");
      });
Aaron Bell
@awb715
Nov 01 2016 02:21
i dont udnerstand "this" @AdelMahjoub
KonSal
@KonSal
Nov 01 2016 02:21
@moT01 it does return the correct url, don't see any problem with line 52
Adel
@AdelMahjoub
Nov 01 2016 02:21
@awb715 this is this, you need to search who named it this
Tom
@moT01
Nov 01 2016 02:22
yea its in that function @KonSal 52-56ish
Adel
@AdelMahjoub
Nov 01 2016 02:22
@awb715 this refers to the current object, in this case #temp
Tom
@moT01
Nov 01 2016 02:22
or maybe my form attributes i dont know, works with my random button
im getting the info
KonSal
@KonSal
Nov 01 2016 02:24
@moT01 but the whole pen is working correctly, i can search for something and see wikipedia results
Tom
@moT01
Nov 01 2016 02:24
is that so
KonSal
@KonSal
Nov 01 2016 02:25
@moT01 yep :)
Tom
@moT01
Nov 01 2016 02:26
well thanks @KonSal ill try another browser maybe that will work
CamperBot
@camperbot
Nov 01 2016 02:26
mot01 sends brownie points to @konsal :sparkles: :thumbsup: :sparkles:
:cookie: 400 | @konsal |http://www.freecodecamp.com/konsal
Stephen James
@sjames1958gm
Nov 01 2016 02:26
@moT01 - change your handler to this to prevent the browser from submitting the page and resetting
    $("#formid").submit(function (e) {
      e.preventDefault();
KonSal
@KonSal
Nov 01 2016 02:26
pen_ss.png
@moT01 yeah, maybe do that. look above, not a single change in ur code.
Stephen James
@sjames1958gm
Nov 01 2016 02:27
@moT01 click works but enter submits the page
KonSal
@KonSal
Nov 01 2016 02:28
@sjames1958gm @moT01 yeah, i get the same result. although after the first reset, the pen is working as expected.
Tom
@moT01
Nov 01 2016 02:29
k, @sjames1958gm thanks, yea i kinda felt like something like that was happening, like the function was running but the page was refreshing and reset my html
CamperBot
@camperbot
Nov 01 2016 02:29
mot01 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4114 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 02:29
@moT01 :+1: nice looking page
Tom
@moT01
Nov 01 2016 02:31
thanks, as long as i got ya, how about the excessive height of the page
yea i did a lot of the other projects pretty quick and they turned out alright, spent a little longer on this one, wanted to make it a little nicer
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:36

SOMEONE PLEASE HELP MEEEEE T.T I'm stuck about 4 days in this piece of sh., i'm at lesson 209 (record collection), and i cant solve this problem, envolving a function for update some data, from and object with another objects and arrays nested. PLEASE, help. TY.

function updateRecords(id, prop, value) {
if (value===""){
delete collection[id][prop];
}else if(prop==="tracks" && value!==""){
collection[id][prop].push(value);
}else{
collection[id][prop]=value;
}
return collection;
}

Joseph
@revisualize
Nov 01 2016 02:38
@ebak123 You're trying to .push() to an array that doesn't exist.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:38
i dono
i'm done
i just wanna pass
urgh
Joseph
@revisualize
Nov 01 2016 02:39
@ebak123 Then just skip it.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:39
i really tryed, but only one point is missing
i cant solve
the second point
Joseph
@revisualize
Nov 01 2016 02:39
@ebak123 Do you want help solving it?
I know exactly what the issue is.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:40
PLEASE
i dont wanna skip it
Joseph
@revisualize
Nov 01 2016 02:40
@ebak123 So, you're trying to .push() to an array that doesn't exist.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:40
okay
Joseph
@revisualize
Nov 01 2016 02:41

@ebak123

    5439: {
      album: "ABBA Gold"
    }

There isn't a tracks array.

@ebak123 But, for the three other child objects. There is a tracks array.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:42
yes
Joseph
@revisualize
Nov 01 2016 02:42
@ebak123 So, you need to solve for this:
If prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property.
@ebak123 So, how do you test if the child object has a "tracks" property?
c0d0er
@c0d0er
Nov 01 2016 02:43
@walidashri thanks
CamperBot
@camperbot
Nov 01 2016 02:43
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 542 | @walidashri |http://www.freecodecamp.com/walidashri
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:43
but if i just type: collection[id][prop] =value; i dont update p´rop value, and if doesnt exist, this line creates then the prop?
Joseph
@revisualize
Nov 01 2016 02:44
@ebak123 But, that isn't an array.
@ebak123 How do you test a child object for a property?
@ebak123 Look, this is going to require another if statement.
livih09
@livih09
Nov 01 2016 02:46
Need help on Recond Collection anyone available? Pm or whatever..
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:47
well
i used the hasOwnProperty.(name)
like, if(some property exist){ do something}
but doesnt work
OOOOOOOOOOOOH
Joseph
@revisualize
Nov 01 2016 02:48
@ebak123 You're not doing it correctly.
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:48
child objects, wait a sex
sec*
i get it, i guess
Joseph
@revisualize
Nov 01 2016 02:51
@livih09 What's your function? (just the function please. We don't need to see the object.)
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:56
i can test the property, using the child concept?
Joseph
@revisualize
Nov 01 2016 02:56
@ebak123 yes.
@ebak123 How do you test an object for a property?
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 02:59
well, by the lessons i've learnd, like this:
function checkObj(checkProp) {
// Your Code Here
var a,b;
a=myObj.hasOwnProperty(checkProp);
if (a === true){
b=myObj[checkProp];
return b;
}else{
return "Not Found";
}
}
?
please dont leave hahahha
Walid Ashri
@walidashri
Nov 01 2016 03:03
@ebak123 this is working :+1:
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 03:04
thanks god, i'll try
actually, thanks you <3
wait, but how can i create a new array property for my object?
Draidel
@Draidel
Nov 01 2016 03:07
guys, i think i found a bug but I need you confirm this before i report it (maybe i am wrong)
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 03:07
im confused
Joseph
@revisualize
Nov 01 2016 03:08
About?
CamperBot
@camperbot
Nov 01 2016 03:08
you need to ask about @someone!

this is how i resolved it:


function dropElements(arr, func) {
  // Drop them elements.

  return arr.filter(func);
}

dropElements([1, 2, 3, 9, 2], function(n) {return n > 2; });

easy

Joseph
@revisualize
Nov 01 2016 03:09
Really?
Draidel
@Draidel
Nov 01 2016 03:09
BUT !, IT SAYS dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}) should return [3, 9, 2]. when i guess it should return just [3,9]
am i wrong ?
João Mhurilo Godoi da Silva
@ebak123
Nov 01 2016 03:09
sorry :/
Joseph
@revisualize
Nov 01 2016 03:10
@Draidel That doesn't resolve the challenge.
@Draidel .filter() iterates across all elements in an array.
Draidel
@Draidel
Nov 01 2016 03:13
oh man @revisualize , you are right
@revisualize thanks ! take some brownies
CamperBot
@camperbot
Nov 01 2016 03:13
draidel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2162 | @revisualize |http://www.freecodecamp.com/revisualize
Maseeh121
@Maseeh121
Nov 01 2016 03:21
yo guys
im stuck on profile lookup
here's my code
Joseph
@revisualize
Nov 01 2016 03:21
What's your function?
Not the object!
ACK!
Maseeh121
@Maseeh121
Nov 01 2016 03:21

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

if (contacts[i][firstName]==firstName){
  a=true;
} 
if (contacts[i][prop]&&a){
  b=true;
} 

if (a&&b){
return contacts[i][prop];
}
}
if (!a){
return "No such contact";
}
if (!b) {
return "No such property";
}
// Only change code above this line
}

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

Joseph
@revisualize
Nov 01 2016 03:22
@Maseeh121 You're overwriting your variable.
Bibek Gautam
@bibek22
Nov 01 2016 03:22

http://codepen.io/bibek22/pen/GjVjVV?editors=1100

I want to center that block just dead center of the screen. how can i do that?

Joseph
@revisualize
Nov 01 2016 03:23
@bibek22 That's a really hard challenge.
Maseeh121
@Maseeh121
Nov 01 2016 03:23
@revisualize in what sense?
Bibek Gautam
@bibek22
Nov 01 2016 03:23
i just want to center that block. :D
.jumbotron
Joseph
@revisualize
Nov 01 2016 03:24
@Maseeh121 Really you should just use www.pythontutor.com/javascript.html and visualize your code execution.
@Maseeh121 Also, your for loop is out of order.
Anthony DeVenuto
@adevenuto
Nov 01 2016 03:25
@bibek22 try: position:absolute;
left:0; right:0;
top:0; bottom:0;
margin:auto;
Bibek Gautam
@bibek22
Nov 01 2016 03:26
@adevenuto okay ! btw, left, right, bottom, right are all values for margin from the respective edge? right? and negetive value would mean closer to it?
Joseph
@revisualize
Nov 01 2016 03:26
@adevenuto That doesn't work.
@adevenuto The problem is that there really isn't a good solution to center things horizontally AND vertically in a viewport.
Maseeh121
@Maseeh121
Nov 01 2016 03:29
@revisualize alright
@revisualize thanks
CamperBot
@camperbot
Nov 01 2016 03:29
maseeh121 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2163 | @revisualize |http://www.freecodecamp.com/revisualize
Anthony DeVenuto
@adevenuto
Nov 01 2016 03:33
@bibek22 you could try something like this: https://jsfiddle.net/railsarr/psp8m2L0/
Joseph
@revisualize
Nov 01 2016 03:35
@bibek22
.jumbotron {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: silver;
  width: 80%;
  margin: auto;
  min-height: 50%;
}
body {
  background: #BDBB99;
}
.quoteby {
  text-align: right;
}
Anthony DeVenuto
@adevenuto
Nov 01 2016 03:35
@revisualize Ya, centering can be tricky. depending on what I'm trying to do I sometimes find myself googling for awhile to find a solution.
Maseeh121
@Maseeh121
Nov 01 2016 03:35
damn , I still don't understand this
Joseph
@revisualize
Nov 01 2016 03:36
@Maseeh121 Neither do I. Hence the reason I just took the lazy route and directed you try visualizing your code.
Maseeh121
@Maseeh121
Nov 01 2016 03:36
lol
why are objects so confusing
Joseph
@revisualize
Nov 01 2016 03:36
@Maseeh121 I mean, I understand the challenge but, the way you're doing it confuses me.
@Maseeh121 The thing is... You must know objects. Everything in JS is either a Primitive or an Object.
Maseeh121
@Maseeh121
Nov 01 2016 03:37
dang
oh
what route what you suggest I take?
Joseph
@revisualize
Nov 01 2016 03:38
@Maseeh121 Just return the thing when you find the thing.
Maseeh121
@Maseeh121
Nov 01 2016 03:38
lol that doesn't help
Joseph
@revisualize
Nov 01 2016 03:38
It doesn't?
Maseeh121
@Maseeh121
Nov 01 2016 03:42
am I itterating through my loop wrong?
Joseph
@revisualize
Nov 01 2016 03:42
@Maseeh121 for (var i=0;i++;i<contacts.length){ is not a correct for loop
for (var i = 0; i < 9; i++) {
   console.log(i);
   // more statements
}
Maseeh121
@Maseeh121
Nov 01 2016 03:44
oh lol
wow
i feel so dumb
lol it worked now
thanks man
thanks @revisualize
CamperBot
@camperbot
Nov 01 2016 03:45
maseeh121 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: maseeh121 already gave revisualize points
Joseph
@revisualize
Nov 01 2016 03:45
@Maseeh121 Did you solve the challenge?
Peter J. Brown
@PJBrown-1
Nov 01 2016 03:45
Can someone help Mutations?
Maseeh121
@Maseeh121
Nov 01 2016 03:46
yup @revisualize
it was just the forloop
Maseeh121
@Maseeh121
Nov 01 2016 03:46
not fomatted correctly
Joseph
@revisualize
Nov 01 2016 03:46
about @Maseeh121
CamperBot
@camperbot
Nov 01 2016 03:46
:cookie: 213 | @maseeh121 |http://www.freecodecamp.com/maseeh121
Peter J. Brown
@PJBrown-1
Nov 01 2016 03:46
I'm so close to finishing this one
I've tried multiple combinations
kalokc
@kalokc
Nov 01 2016 03:48

Hi all, just a general question on programming practice:

Is it bad to change the original array in this case
arr = arr.map(callback[, thisArg])

or should we always assign the return value to a new variable?
var new_array = arr.map(callback[, thisArg])

kalokc
@kalokc
Nov 01 2016 03:54
What I meant was, if I have to use a method to perform a change on an array, should we always avoid changing the original array?
Doug Riblet
@DougRiblet
Nov 01 2016 03:56

@kalokc It depends. You often want your function to not change an array passed in as a parameter. Like:

function doSomething(array){
  return changedArray;
}

You might want that original array kept intact, so you would write your function to not change it. But inside a function, you usually don't have to worry about creating a new variable every time you change something.

grantknaver
@grantknaver
Nov 01 2016 03:56
When you do the Caesars Cipher are you supposed to use extended if and else statements, or add 13 to the unicode of a given index?
just curious
Doug Riblet
@DougRiblet
Nov 01 2016 03:59
@kalokc Some Array methods change the original array, some don't. Remembering which are which is just a matter of time & practice.
kalokc
@kalokc
Nov 01 2016 04:00
@smashzen Thanks for your response Doug!
I was concern if the array has like, million items in it, and instead of changing the original I will have to sacrifice the memory space to contain twice the size of the original array.
CamperBot
@camperbot
Nov 01 2016 04:00
kalokc sends brownie points to @smashzen :sparkles: :thumbsup: :sparkles:
:cookie: 489 | @smashzen |http://www.freecodecamp.com/smashzen
Ken Haduch
@khaduch
Nov 01 2016 04:01
@PJBrown-1 - you should really be checking individual letters from the second array to see if they exist in the first array. I'm not sure what you are doing - checking the entire array against the first? You need to change your algorithm - looks like you are always returning true because you don't pass any of the tests that expect false.
Doug Riblet
@DougRiblet
Nov 01 2016 04:01

@kalokc One useful technique is

function doSomething(array){
  var copyOfArray = array.slice(0);
  . . .
}

That leaves array intact, and you can modify copyOfArray all you want before returning.

Ken Haduch
@khaduch
Nov 01 2016 04:02
@grantknaver - basically, you should be adding 13 to the unicode value of some letters, and subtract 13 from the unicode value of others.
grantknaver
@grantknaver
Nov 01 2016 04:03
@khaduch that is what I though but
...
KonSal
@KonSal
Nov 01 2016 04:03
@grantknaver just adding 13 to the unicode won't work for letter after N. using char codes is the best solution, but you gotta keep in mind what happens after the first 13 letters
kalokc
@kalokc
Nov 01 2016 04:04
@smashzen Thanks Doug!
So one rule is that when an array that's passed as an argument, don't mess around with it.
CamperBot
@camperbot
Nov 01 2016 04:04
kalokc sends brownie points to @smashzen :sparkles: :thumbsup: :sparkles:
:warning: kalokc already gave smashzen points
KonSal
@KonSal
Nov 01 2016 04:04
@ydeepk please have your code inside 3 backticks before and after you code block
Joseph
@revisualize
Nov 01 2016 04:04

How to do code block format:
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The key can usually be found on most keyboards up next to the 1 key. If you hit SHIFT+ it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

grantknaver
@grantknaver
Nov 01 2016 04:05
basically you just use if statements to setup if you are going to subtract or add @KonSal. Am I on the right path?
KonSal
@KonSal
Nov 01 2016 04:05
@grantknaver yep, exactly that :)
Deepak Yadav
@ydeepk
Nov 01 2016 04:05

Intermediate algo Challange ( Everything be true )
My Problem :

Not getting required output. Dont know why please help

My code :

function truthCheck(collection, pre) {

var arrLen = collection.length,
x;

for(x = 0; x < arrLen; x++) {

var hasProp = collection[x].hasOwnProperty(pre),
matchValue = collection[x][pre],
ifNaN = isNaN(matchValue);

if(!hasProp) {
if(ifNaN || matchValue === undefined || matchValue === 0 || matchValue === false || matchValue === "" || matchValue === null) {
return false;
}
}
}
return true;
}

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");

should return true

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");

Should return false

I think some thing wrong in my if Statement please help guys anyone.

grantknaver
@grantknaver
Nov 01 2016 04:05
easy peasy
Deepak Yadav
@ydeepk
Nov 01 2016 04:06
@KonSal sorry wats that ?
KonSal
@KonSal
Nov 01 2016 04:06
``` before and after code
so it will be formatted @ydeepk
Joseph
@revisualize
Nov 01 2016 04:06
@ydeepk Please stop spamming.

Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - https://gist.github.com/ paste the link here.

KonSal
@KonSal
Nov 01 2016 04:07
look at what @revisualize posted above @ydeepk .
Joseph
@revisualize
Nov 01 2016 04:07
@ydeepk This is not IRC you don't need to spam your post over and over and over.
Deepak Yadav
@ydeepk
Nov 01 2016 04:08
Thanks for Tips and basics @KonSal && @revisualize
CamperBot
@camperbot
Nov 01 2016 04:08
ydeepk sends brownie points to @konsal and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2164 | @revisualize |http://www.freecodecamp.com/revisualize
:cookie: 401 | @konsal |http://www.freecodecamp.com/konsal
Deepak Yadav
@ydeepk
Nov 01 2016 04:08
@revisualize I posted only once if u check it
Joseph
@revisualize
Nov 01 2016 04:09
@ydeepk No, I've been watching chat. You've posted. and deleted and posted and deleted and posted and deleted.
KonSal
@KonSal
Nov 01 2016 04:11
@ydeepk on another note, look at for...in loops, might help you make your code much more simple and find your possible mistakes
Deepak Yadav
@ydeepk
Nov 01 2016 04:14
@revisualize yes i did that, i was trying to format code properly for easy read. deleteing code means by me means it been removed. So how come it becomes spamming let the gitter bot do their job. You do not worry that much about spamming.
@KonSal thanks
CamperBot
@camperbot
Nov 01 2016 04:14
ydeepk sends brownie points to @konsal :sparkles: :thumbsup: :sparkles:
:warning: ydeepk already gave konsal points
Joseph
@revisualize
Nov 01 2016 04:31
cbot
CamperBot
@camperbot
Nov 01 2016 04:31
you called?
grantknaver
@grantknaver
Nov 01 2016 04:53
what is the unicode for space?
Carlos
@cquinones100
Nov 01 2016 04:55
anyone else stuck on the record collection challenge?
I've got all but "After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element"
here's my code
if (prop !== "tracks" && value !== "") {
collection[id][prop] = value;
}
else if (prop === "tracks" && value === ""){
delete collection[id][prop];
}
else if (prop === "tracks" && value !== ""){
collection[id][prop].push(value);
}
else if (prop === "artist" && value === ""){
delete collection[id][prop];
}
RakeshNerkar
@Rakesh18754
Nov 01 2016 05:23

I want to pass a variable in jquery selector any help on this?

var parentEle = $(this).parents("[id^='menu']").parent(".multi-parent");

$("parentEle > div" ).

grantknaver
@grantknaver
Nov 01 2016 05:28
Why is this not working?
everything is returning correct...so weird
Jeff Shapiro
@Jeff-Shapiro
Nov 01 2016 05:29
@grantknaver because its not correct
grantknaver
@grantknaver
Nov 01 2016 05:29
@Jeff-Shapiro lol\
thanks
var array22 = [];
var letter;
var sentence = "";
function rot13(str) { // LBH QVQ VG!
  for (var i = 0; i < str.length; i++) {
    var value1 = str.charCodeAt(i);
    if (value1 < 65) {
      letter = value1;
      var con0 = String.fromCharCode(letter);
      sentence += con0;
    }
    else if (value1 < 78) {
      letter = value1 + 13;
      var con = String.fromCharCode(letter);
      sentence += con;
    }
    else if (value1 >= 78) {
      letter = value1 - 13;
      var con2 = String.fromCharCode(letter);
      sentence += con2;
    }
  }

  var final = sentence.replace(/-/g, " ");
  return final;
}
everything returns correct
all the tests work but it is just ont working
maybe a browser error?
layton101
@laytan101
Nov 01 2016 05:31
@cquinones100 you’re missing to take care of this scenario: If prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property.
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:32

// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber=testObj[16]; // Change this Line
var player = testObj[12]; // Change this Line

@laytan101 how we can acessobject propoerties with Variables

@laytan101
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber=testObj[16]; // Change this Line
var player = testObj[12]; // Change this Line
how can Accessing Objects Properties with Variables

layton101
@laytan101
Nov 01 2016 05:34
@Jeevandeep235 you first need to create a variable assigned to the value you want
grantknaver
@grantknaver
Nov 01 2016 05:34
any ideas
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:34
how we create @laytan101
layton101
@laytan101
Nov 01 2016 05:35
var a = 16;
var playerNumber = testObj[a];
grantknaver
@grantknaver
Nov 01 2016 05:42
Ya for all intensive purposes this code is perfect. Maybe longer than need be, but solid. Anyone have any ideas as to why it will not let me pass. All the tests have past and still nothing.
var letter;
var sentence = "";
function rot13(str) { // LBH QVQ VG!
  for (var i = 0; i < str.length; i++) {
    var value1 = str.charCodeAt(i);
    if (value1 < 65) {
      letter = value1;
      var con0 = String.fromCharCode(letter);
      sentence += con0;
    }
    else if (value1 < 78) {
      letter = value1 + 13;
      var con = String.fromCharCode(letter);
      sentence += con;
    }
    else if (value1 >= 78) {
      letter = value1 - 13;
      var con2 = String.fromCharCode(letter);
      sentence += con2;
    }
  }

  var final = sentence.replace(/-/g, " ");
  return '"'+final+'"';
}
https://www.freecodecamp.com/challenges/caesars-cipher#?solution=var%20letter%3B%0Avar%20sentence%20%3D%20%22%22%3B%0Afunction%20rot13(str)%20%7B%20%2F%2F%20LBH%20QVQ%20VG!%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20str.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20var%20value1%20%3D%20str.charCodeAt(i)%3B%0A%20%20%20%20if%20(value1%20%3C%2065)%20%7B%0A%20%20%20%20%20%20letter%20%3D%20value1%3B%0A%20%20%20%20%20%20var%20con0%20%3D%20String.fromCharCode(letter)%3B%0A%20%20%20%20%20%20sentence%20%2B%3D%20con0%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%20if%20(value1%20%3C%2078)%20%7B%0A%20%20%20%20%20%20letter%20%3D%20value1%20%2B%2013%3B%0A%20%20%20%20%20%20var%20con%20%3D%20String.fromCharCode(letter)%3B%0A%20%20%20%20%20%20sentence%20%2B%3D%20con%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%20if%20(value1%20%3E%3D%2078)%20%7B%0A%20%20%20%20%20%20letter%20%3D%20value1%20-%2013%3B%0A%20%20%20%20%20%20var%20con2%20%3D%20String.fromCharCode(letter)%3B%0A%20%20%20%20%20%20sentence%20%2B%3D%20con2%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20%20%0A%20%20var%20final%20%3D%20sentence.replace(%2F-%2Fg%2C%20%22%20%22)%3B%0A%20%20return%20%27%22%27%2Bfinal%2B%27%22%27%3B%0A%7D%0A%0A%2F%2F%20Change%20the%20inputs%20below%20to%20test%0Arot13(%22GUR%20DHVPX%20OEBJA%20QBT%20WHZCRQ%20BIRE%20GUR%20YNML%20SBK.%22)%3B%0A
Muliro1
@Muliro1
Nov 01 2016 05:44

making object properties private what's wrong with my code ? var Bike = function() {

// Only change code below this line.
var gear = 4;

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

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

};

var myCar = new Car();

var myBike = new Bike();

Alexis
@alexisnoel
Nov 01 2016 05:44
Screen Shot 2016-11-01 at 12.43.37 AM.png
code keeps saying it's undefined
almuallem
@almuallem
Nov 01 2016 05:45
@alexisnoel What's the challenge name ?
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:46

@laytan101 can we not directly acess through object properties

@laytan101 after assigning it is not comeing

Alexis
@alexisnoel
Nov 01 2016 05:46
accessing nested objects
layton101
@laytan101
Nov 01 2016 05:48
@grantknaver you don’t need to add the quotes before returning :)
@grantknaver not sure why you need the replace call before returning
almuallem
@almuallem
Nov 01 2016 05:50
@alexisnoel the "glove box property has a space between the two words "glove" and "box". So you should use the bracket notation as instructed. It would be something like this: myStorage.car.inside["glove box"];
layton101
@laytan101
Nov 01 2016 05:51
@Jeevandeep235 what error are you getting
Alexis
@alexisnoel
Nov 01 2016 05:52
@almuallem thank you it worked!!!
CamperBot
@camperbot
Nov 01 2016 05:52
alexisnoel sends brownie points to @almuallem :sparkles: :thumbsup: :sparkles:
:cookie: 261 | @almuallem |http://www.freecodecamp.com/almuallem
almuallem
@almuallem
Nov 01 2016 05:52
@alexisnoel Any time :D
grantknaver
@grantknaver
Nov 01 2016 05:53
@laytan101 lol I know I dont need the quotes. I have been just trying to get the assignment to pass me lol
layton101
@laytan101
Nov 01 2016 05:53
@grantknaver and I had to move down the letter and sentence variable declaractions into the method. otherwise FCC won’t let me pass through.
grantknaver
@grantknaver
Nov 01 2016 05:53
oooo
didn't think of that
layton101
@laytan101
Nov 01 2016 05:54
@grantknaver not sure why that is though. wouldn’t they be just global variables if declared outside...
grantknaver
@grantknaver
Nov 01 2016 05:54
yep
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:54
@laytan101 i am not gettong any error\
grantknaver
@grantknaver
Nov 01 2016 05:54
doesnt want you use to global apparently... weird
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:54

this is my code var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;
var a = 16;
var b=12;
var playerNumber=testObj[a]; // Change this Line
var player = testObj[12];

layton101
@laytan101
Nov 01 2016 05:55
@Jeevandeep235 what’s your question? sorry I didn’t fully get it.
@Jeevandeep235 that looks right. you could replace 12 with b for player too.
Asadullah5600
@Asadullah5600
Nov 01 2016 05:56
hello
Jeevan Deep
@Jeevandeep235
Nov 01 2016 05:56
then how i can access different object properties
grantknaver
@grantknaver
Nov 01 2016 05:56
@laytan101 can you paste your code. I moved my variables down and it still wont let me pass, but everything is working great. Ill just copy and paste... hopefully that works.
layton101
@laytan101
Nov 01 2016 05:57
function rot13(str) { // LBH QVQ VG!
var letter;
var sentence = "";
  for (var i = 0; i < str.length; i++) {
    var value1 = str.charCodeAt(i);
    if (value1 < 65) {
      letter = value1;
      var con0 = String.fromCharCode(letter);
      sentence += con0;
    }
    else if (value1 < 78) {
      letter = value1 + 13;
      var con = String.fromCharCode(letter);
      sentence += con;
    }
    else if (value1 >= 78) {
      letter = value1 - 13;
      var con2 = String.fromCharCode(letter);
      sentence += con2;
    }
  }

  var final = sentence.replace(/-/g, " ");
  return final;
}
grantknaver
@grantknaver
Nov 01 2016 05:57
nvm
layton101
@laytan101
Nov 01 2016 05:57
@grantknaver i don’t think i changed anything else :)
grantknaver
@grantknaver
Nov 01 2016 05:58
I forgot to delete the quotes I added to try to get it to pass me lol
layton101
@laytan101
Nov 01 2016 05:58
haha
@Jeevandeep235 can you send me the link to the question you’re working on
almuallem
@almuallem
Nov 01 2016 06:00
@Muliro1 The function setGear is incorrect. The "change" value should be assigned directly to gear. So if the user entered 5, the gear value should be 5 not increased by 5.
@Muliro1 So just change this line: gear += change; // and make it something like this: gear=change;
scottmike0
@scottmike0
Nov 01 2016 06:08
i still do not quite understand the ceasar cipher coding question
Muliro1
@Muliro1
Nov 01 2016 06:11
thanks @almuallem
CamperBot
@camperbot
Nov 01 2016 06:11
muliro1 sends brownie points to @almuallem :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @almuallem |http://www.freecodecamp.com/almuallem
scottmike0
@scottmike0
Nov 01 2016 06:11
is there a way I am able to solve this without hardcoding?
i really want to make multiple conditionals
Markus Kiili
@Masd925
Nov 01 2016 06:12
@scottmike0 You can test the charcode of a character to be in the range A-Z and then do the transformation with couple of if's or one remainder operation.
scottmike0
@scottmike0
Nov 01 2016 06:14
so, i think i maybe onto something, but if A goes to N, does that mean I simply use the char range of any part of the letter and then Add 13 to it?
Markus Kiili
@Masd925
Nov 01 2016 06:17
@scottmike0 You can do it with a test and adding or subtracting to the charcode.
scottmike0
@scottmike0
Nov 01 2016 06:18
what do you mean subtracting, i thought because we are only converting to a different letter we simply add?
wait, javascripts does not have chars, so what can i do to convert a number to a character?
Markus Kiili
@Masd925
Nov 01 2016 06:22
@scottmike0 The character should stay at range A-Z so you can't simply add to charcode. How do you add to Z?
String.fromCharCode()
Characters are just strings of length 1.
scottmike0
@scottmike0
Nov 01 2016 06:23
but, fromCharCode requires a function though
Markus Kiili
@Masd925
Nov 01 2016 06:24
No, the argument is a number (or numbers).
You can also make it work on an array of numbers.
scottmike0
@scottmike0
Nov 01 2016 06:25
return str.charCodeAt(1); this code sends an error that it is not a function
as i am testing it on how it works
Markus Kiili
@Masd925
Nov 01 2016 06:28
var str = "cat";
str.charCodeAt(0); // 99

String.fromCharCode(65); // "A"

var arr = [65,66,67];
String.fromCharCode.apply(null,arr); // "ABC"
This is the way to use them.
scottmike0
@scottmike0
Nov 01 2016 06:28
never mind, i meant the one with String.fromCharCode(). Apparently the function fromCharCode only applies to String, rather than any string
so do i have to make cases to where I do not go past z?
Markus Kiili
@Masd925
Nov 01 2016 06:30
@scottmike0 Yes, fromCharCode has nothing to do with any particular string, so it is stored on String constructor.
@scottmike0 You can add to certain charcodes and subtract from the others.
Or make a remainder operation that handles all charcodes.
scottmike0
@scottmike0
Nov 01 2016 06:31
gonna see if i can simply rely on recursion to solve this
scottmike0
@scottmike0
Nov 01 2016 06:36
what number is z for char
RakeshNerkar
@Rakesh18754
Nov 01 2016 06:37

I want to pass a variable in jquery selector

var parentEle = $(this).parents("[id^='menu']").parent(".multi-parent");
then that element will get removed
$(this).closest('[id^="menu"]').remove();

and once i cache the element i want to select the immediate div inside it

$(parentEle + "> div" )

can any one provide any Jquery solution or JS way for this

Yoerivw
@Yoerivw
Nov 01 2016 06:40
Good morning fellow Coders, I've got stuck with my Twitch.api project. http://codepen.io/yoerivw/pen/YGNbLQ?editors=0011 I can't seem to target the ( channels[i] ) to display the name of the channel being called upon.
grantknaver
@grantknaver
Nov 01 2016 06:41
function chunkArrayInGroups(arr, size) {
 var mainArray = [];
  for (var i = 0; i < arr.length, i+size;) {
    var num1 = arr.slice(i, size);
     return mainArray.push(num1);
  }

}
Yes Im wrong. I know any tips?
Markus Kiili
@Masd925
Nov 01 2016 06:43
@grantknaver i+=size
Or i=i+size
i+size just returns a number that is not used.
scottmike0
@scottmike0
Nov 01 2016 06:44
@Rakesh18754 i dont really comprehend your question can you be more specific
Markus Kiili
@Masd925
Nov 01 2016 06:45
@grantknaver You also have something wrong with the slice arguments slice(start, end)
grantknaver
@grantknaver
Nov 01 2016 06:46
how is the slice wrong
I start where the incrim ended slice according to the size?
*and slice according to the size
RakeshNerkar
@Rakesh18754
Nov 01 2016 06:47
@scottmike0 How to use javascript variables in jquery selectors??
i simple terms
Markus Kiili
@Masd925
Nov 01 2016 06:47
@grantknaver You increment i but end every slice at index size
Greg Duncan
@GregatGit
Nov 01 2016 06:47
@Yoerivw Twitch changed their api. I'm not sure if FCC is even going to stick with that project anymore
grantknaver
@grantknaver
Nov 01 2016 06:49
@Masd925 can you break it down anymore than that
it doesnt like i+=size or
Markus Kiili
@Masd925
Nov 01 2016 06:50
@grantknaver If the slice starts at index i, then the end index should be i+something <- what could that something be ;)
scottmike0
@scottmike0
Nov 01 2016 06:51
@Rakesh18754 what is the goal?
grantknaver
@grantknaver
Nov 01 2016 06:51
hmmm
size, right?
var num1 =arr.slice(i, i+=size);
Markus Kiili
@Masd925
Nov 01 2016 06:53
@grantknaver (i,i+size)
Otherwise you increment i twice.
Here you just calculate the end index of slice and pass it into slice method. You increment i at the end of for loop.
grantknaver
@grantknaver
Nov 01 2016 06:57
this is what I got so far
or (var i = 0; i < arr.length, i+=size) {
    var num1 =arr.slice(i, i+size);
     return mainArray.push(num1);
  }

}
sorry...

function chunkArrayInGroups(arr, size) {
 var mainArray = [];
  for (var i = 0; i < arr.length, i+=size) {
    var num1 =arr.slice(i, i+size);
     return mainArray.push(num1);
  }

}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Markus Kiili
@Masd925
Nov 01 2016 06:58
@grantknaver Inside the loop block you just push to result array. After the loop you return the result array.
Return ends the function execution. You wan't the function to push all the slices, not just one.
Fernando Sugianto
@fyzz100
Nov 01 2016 07:01
Help! im stuck in Stand in Line....
CamperBot
@camperbot
Nov 01 2016 07:01
no wiki entry for: im stuck in stand in line
scottmike0
@scottmike0
Nov 01 2016 07:01
anyone know if this logic is off? I feel like it is, because i am getting over the limit
function rot13(str) { // LBH QVQ VG!
  var newstr = "";
  //for(var i = 0; i<str.length;i++){
  //  newstr += str.charCodeAt()
 // }
  //var my_char = str.charCodeAt(25);
 // var bob = String.fromCharCode(25);
  return recurse(str,0,"");// 65 + 25= 90- 13 = 77

}
function recurse(str,start,final_str){
  if(start>str.length)
    return final_str;
  else if(String.fromCharCode(78) >= str.charCodeAt(start)){
    // subtract
    final_str += String.fromCharCode(str.charCodeAt(start)-13);
    return recurse(str,start+1,final_str) ;
  }
  // else case we add
  final_str += String.fromCharCode(str.charCodeAt(start)+13);
  return recurse(str,start+1,final_str);// will never happen

}
grantknaver
@grantknaver
Nov 01 2016 07:03

function chunkArrayInGroups(arr, size) {
 var mainArray = [];
  for (var i = 0; i < arr.length, i=+size;) {
    var num1 =arr.slice(i, i+size);
    mainArray.push(num1);
  }
  return mainArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
doesnt like my for loop incrimentation
Manish Giri
@Manish-Giri
Nov 01 2016 07:03
@fyzz100 what are you stuck at
@grantknaver i += size
grantknaver
@grantknaver
Nov 01 2016 07:04
honestly dont know at this point
Markus Kiili
@Masd925
Nov 01 2016 07:06
@grantknaver Just put i+=size on the for loop definition instead of i=+size
grantknaver
@grantknaver
Nov 01 2016 07:06
I did already
Manish Giri
@Manish-Giri
Nov 01 2016 07:06

@grantknaver look at your for loop

 for (var i = 0; i < arr.length, i=+size;)

the last part should increment i by some quantity ,instead you're just assigning i as size, so there's no increment

also you have a , after arr.length, that should be a ;
and you don't need a ; after the increment
Markus Kiili
@Masd925
Nov 01 2016 07:07
@grantknaver After fixing those it should work.
Yoerivw
@Yoerivw
Nov 01 2016 07:08
@GregatGit So should I just proceed with the rest of freecodecamp curriculum and come back later to it if it's still there ? thanks for the response
CamperBot
@camperbot
Nov 01 2016 07:08
yoerivw sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 781 | @gregatgit |http://www.freecodecamp.com/gregatgit
grantknaver
@grantknaver
Nov 01 2016 07:09
@Masd925 & @Manish-Giri thanks. I think Im getting tired. Those were some obvious mistakes thanks
CamperBot
@camperbot
Nov 01 2016 07:09
grantknaver sends brownie points to @masd925 and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2153 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 2818 | @masd925 |http://www.freecodecamp.com/masd925
almuallem
@almuallem
Nov 01 2016 07:11
@fyzz100 What's it that you are stuck in? What is your current solution ?
Fernando Sugianto
@fyzz100
Nov 01 2016 07:13
@almuallem i dont know what to do..
@Manish-Giri I dont understand the instruction
almuallem
@almuallem
Nov 01 2016 07:14
@fyzz100 You will be given an array and an item (arr,item). You should add (push) the item to the end of the array and then remove first item of the array. The function should return this removed item.
scottmike0
@scottmike0
Nov 01 2016 07:15
what number is space
Manish Giri
@Manish-Giri
Nov 01 2016 07:15
@fyzz100 the first part is to push the variable called item to the end of the array called arr. Look at the push documentation if you need help - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
scottmike0
@scottmike0
Nov 01 2016 07:17
is there a site where i can find a list of characters associated with their equivilant numbers
almuallem
@almuallem
Nov 01 2016 07:17
@fyzz100 So if you have this: ([1,2,3],18). The function should add (push) the item (in this case the number 18) to the end of the array. and then remove the first element(in this case the number 1). The return of the function should be this removed element.
Fernando Sugianto
@fyzz100
Nov 01 2016 07:18
@Manish-Giri @almuallem
is this correct?
testArr.push(item)
testArr.shift();
Manish Giri
@Manish-Giri
Nov 01 2016 07:18
@fyzz100 your array is arr, not testArr
@fyzz100 and, arr.shift() will remove the first item from arr. But you still need to return it from your function, how would you do that?
Fernando Sugianto
@fyzz100
Nov 01 2016 07:20
@Manish-Giri this is so hard XD
almuallem
@almuallem
Nov 01 2016 07:20
@fyzz100 It's not. You have already solved 90% of it. :D
Manish Giri
@Manish-Giri
Nov 01 2016 07:20
@fyzz100 it's okay, remember the keyword return? That keyword returns whatever follows next, so...
Aarya Bhorra
@aarya1302
Nov 01 2016 07:22

function titleCase(str) {
str.toLowerCase();
return str;
}

titleCase("IM A LITTLE TEA POT");

the toLowerCase function is not working for some reason
Please help me
Ian
@toianw
Nov 01 2016 07:23
@scottmike0 you could just open the browser console and type " ".charCodeAt(0); to find out.
scottmike0
@scottmike0
Nov 01 2016 07:23
thats true
Manish Giri
@Manish-Giri
Nov 01 2016 07:24
@aarya1302 that's cause you're not saving the returned value anywhere - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase
scottmike0
@scottmike0
Nov 01 2016 07:24
though i could not figure out why my recursion did not work
are you able to help?
Yrjö Pokkinen
@ypokkinen
Nov 01 2016 07:24
I am in Escaping Literal Quotes in Strings task. I got console text right, but it doesn't get approved. var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line. Error is you should use two double quotes(") and four escaped double quotes(\")
Aarya Bhorra
@aarya1302
Nov 01 2016 07:25
Okk thanks @Manish-Giri
CamperBot
@camperbot
Nov 01 2016 07:25
aarya1302 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2154 | @manish-giri |http://www.freecodecamp.com/manish-giri
almuallem
@almuallem
Nov 01 2016 07:26
@aarya1302 toLowerCase() will not change the original string. Hence, you may directly use it in the return statement : return str.toLowerCase(); or assign it to the the original string: str=str.toLowerCase();
Yrjö Pokkinen
@ypokkinen
Nov 01 2016 07:28
I am using Firefox 49.0.2 if it matters.
scottmike0
@scottmike0
Nov 01 2016 07:29
anyone able to assist me
Manish Giri
@Manish-Giri
Nov 01 2016 07:29
@ypokkinen can you copy paste your challenge URL from the browser
@scottmike0 what do you need
kirbyedy
@kirbyedy
Nov 01 2016 07:30
@ypokkinen might be the spaces
Yrjö Pokkinen
@ypokkinen
Nov 01 2016 07:30
yes
kirbyedy
@kirbyedy
Nov 01 2016 07:30
"I am a \"double quoted\" string inside \"double quotes\"."
Yrjö Pokkinen
@ypokkinen
Nov 01 2016 07:30
var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line
scottmike0
@scottmike0
Nov 01 2016 07:31
@Manish-Giri am confused why my recursive method is adding an additional character
never mind
kirbyedy
@kirbyedy
Nov 01 2016 07:31
@ypokkinen your line passes on my computer
scottmike0
@scottmike0
Nov 01 2016 07:31
found the part
kirbyedy
@kirbyedy
Nov 01 2016 07:31
try to refresh, reset the code, maybe clear the cache
scottmike0
@scottmike0
Nov 01 2016 07:32
 if(start>=str.length)
    return final_str;
damn equal made the difference
Manish Giri
@Manish-Giri
Nov 01 2016 07:32
cool
Yrjö Pokkinen
@ypokkinen
Nov 01 2016 07:32
Okay thanks @kirbyedy
CamperBot
@camperbot
Nov 01 2016 07:32
ypokkinen sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1491 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
scottmike0
@scottmike0
Nov 01 2016 07:33
thanks @Manish-Giri
CamperBot
@camperbot
Nov 01 2016 07:33
scottmike0 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2155 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Nov 01 2016 07:34
@scottmike0 :+1:
scottmike0
@scottmike0
Nov 01 2016 07:34
but how can i make my code work for both cases?
rot 13 and opposite?
or does it
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:39
@scottmike0 Have you looked into modulus operator?
scottmike0
@scottmike0
Nov 01 2016 07:40
yeah modulus operator is %
oh i remember abhisekp
its been ahwhile
is there an even easier way?
to solve ceasar cipher?
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:42
@scottmike0 easier NO. Complicated YES
Short YES
scottmike0
@scottmike0
Nov 01 2016 07:43
i mean i kinda had to rethink my logic with that recursive solving
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:43
no recursion necessary
scottmike0
@scottmike0
Nov 01 2016 07:44
would the moding be quite abit of if statements?
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:44
@scottmike0 try to implement it using modulus. See how it goes ;)
@scottmike0 also try to make use of String#replace and regex
scottmike0
@scottmike0
Nov 01 2016 07:45
i still have no idea how to use regex
Manish Giri
@Manish-Giri
Nov 01 2016 07:45
@abhisekp i've been meaning to PM you to ask you a few things about react, can I do that now?
scottmike0
@scottmike0
Nov 01 2016 07:45
and what is the purpose of string replace?
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:46
@Manish-Giri I'm learning React myself :scream:
Manish Giri
@Manish-Giri
Nov 01 2016 07:46
@abhisekp lol pls you already know it
:smile:
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:46
WAHT!! no. :scream:
:D
Manish Giri
@Manish-Giri
Nov 01 2016 07:46
eh I don't believe you
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:46
:(
scottmike0
@scottmike0
Nov 01 2016 07:46
its been so damn long since i actually got back into coding though
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:47
seriously, ... i don't know... @Manish-Giri :(
i feel so ashamed of myself now :pensive:
Manish Giri
@Manish-Giri
Nov 01 2016 07:47
@abhisekp :smiling_imp:
@abhisekp but I've been told you know
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:48
scottmike0
@scottmike0
Nov 01 2016 07:51
why use replace though
memory?
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:51
@Manish-Giri found something nice today. Hope it helps while Reacting http://presentations.survivejs.com/advanced-webpack
https://gitter.im/survivejs/training
Shkrel
@1118am
Nov 01 2016 07:52
Hi there! I was wondering if anyone could help me out with the Record Collection challenge?
I'm not too sure how to write a function to update a record
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:52
@scottmike0 to transform a string into a new string by replacing characters in a string
Markus Kiili
@Masd925
Nov 01 2016 07:53
@1118am Test value and prop as asked and access collection on if blocks. Tracks property needs extra care.
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:53
@scottmike0 'Scott'.replace('tt', 're'); // Score
scottmike0
@scottmike0
Nov 01 2016 07:53
but i feel like you can just create a new string and that contained the replaced characters.
' 'Abhisek'.replace('hisek','ra'); // Abra '
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 07:55
hi , I am trying to complete " Counting cards. " I did the following code, though I get the correct output , It is still doesnt pass

var count = 0;

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

if (card == 2 || card==3 || card==4 || card==5 || card==6 ){

count += 1;
return " "+ count +" Bet";

}
else if(card == 7 || card==8 || card==9 ){
count += 0;
return " " + count + "";
}
else if(card == 10 || card=="J" || card=="Q" || card=="K" || card=="A" ){
count -= 1;
return " " + count + " Hold";
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(2); cc("A"); cc(10); cc("K");

Thanks
scottmike0
@scottmike0
Nov 01 2016 07:56
@Vijayanandkrishnan whats the requirements again?
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 07:57
@scottmike0
You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then 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.
Count Change Cards
+1 2, 3, 4, 5, 6
0 7, 8, 9
-1 10, 'J', 'Q', 'K', 'A'
Abhisek Pattnaik
@abhisekp
Nov 01 2016 07:58
@scottmike0 String#replace is like search and replace.
You can search
  • by string matching
  • by regex pattern matching
@scottmike0 and replace by
  • another string
  • using function (more powerful :zap:)
scottmike0
@scottmike0
Nov 01 2016 08:01
@Vijayanandkrishnan the problem is i think the beginning space in your return statement, as you said you are getting the correct answer
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:01
if you're in need of power and pleasure and happiness, then use String#replace @scottmike0
If you seek the Ultimate, then use regex with it
Ilian Iliev
@zaken
Nov 01 2016 08:02
@Vijayanandkrishnan I suggest you use a switch and list possible cards as cases
scottmike0
@scottmike0
Nov 01 2016 08:03
@Vijayanandkrishnan that should help you lead the way into solving that
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:03
@scottmike0 ahh yes, now i get few scenarios correct. checking why i dont get the rest
@dzift yes, I tried switch too and came to ifelse
scottmike0
@scottmike0
Nov 01 2016 08:05
@abhisekp but if i take advantage of string replace and regex, i will miss it and abuse it at the same time, missing it when i go to other programming languages and abusing because i dont feel like creating my own....
Ilian Iliev
@zaken
Nov 01 2016 08:05
@Vijayanandkrishnan did you already solve it using a switch ?
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:06
@dzift no , i tried with switch and moved to ifelse
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:07
@scottmike0 I would suggest to Stay with JavaScript. ;) ;P
scottmike0
@scottmike0
Nov 01 2016 08:07
@Vijayanandkrishnan did ya make sure you have breaks after the cases?
@abhisekp sounds like this javascript guy is gonna hunt me down, as he has converted you.
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:08
@scottmike0 str.replace(/[A-Z]/g, L => String.fromCharCode(65 + L.charCodeAt(0) % 26) ROT13 :shipit:
scottmike0
@scottmike0
Nov 01 2016 08:08
@abhisekp hax
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:08
@scottmike0 yes, since i couldnt insert statements and count values using switch, i moved to
ifelse
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:09
@scottmike0 credits to @Masd925 too for shortening it
scottmike0
@scottmike0
Nov 01 2016 08:10
@abhisekp my brain hurts from reading the first part /[A-Z]/g, L =>
Ilian Iliev
@zaken
Nov 01 2016 08:10
@Vijayanandkrishnan remove the space here -> return " " + count + "";
Fernando Sugianto
@fyzz100
Nov 01 2016 08:10
@Manish-Giri @almuallem I gave up,can you guys tell me what should i type after the return? Q.Q
my head hurts so much lol
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:10
@scottmike0 do you remember regex?
Ilian Iliev
@zaken
Nov 01 2016 08:11
@Vijayanandkrishnan -> return count + " Bet";
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:11
if you want to brush it up, i can provide some links @scottmike0
scottmike0
@scottmike0
Nov 01 2016 08:11
@abhisekp i mean i know what A-Z means, but I do not understand the /g and , and L
Manish Giri
@Manish-Giri
Nov 01 2016 08:11
@fyzz100 you can just put return before arr.shift(), after all, isn’t that what you want to return?
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:12

@dzift this is wat i did with switch before moving switch (card){

 case 2:
 case 3:
 case 4:
 case 5:
 case 6:

count += 1;
break;

 case 7:
 case 8:
 case 9:

count +=0 ;
break;

 case 10:
 case "J":
 case "Q":
 case "K":
 case "A":

count -= 1;
break;

}

if (count > 1){

return ""+ count +" Bet";

}

Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:12
@scottmike0 i suggest to review regex a bit
Manish Giri
@Manish-Giri
Nov 01 2016 08:12
@abhisekp thanks for the links, I’ll look thru them, btw I still want to ask you those questions I had :wink:
CamperBot
@camperbot
Nov 01 2016 08:12
manish-giri sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star2: 3129 | @abhisekp |http://www.freecodecamp.com/abhisekp
scottmike0
@scottmike0
Nov 01 2016 08:12
@abhisekp so much for them links
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:12
@Manish-Giri hehe .. i don't know if I can answer ;P
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:13
@dzift yes - however i am getting these scenarios wrong
ards Sequence 2, J, 9, 2, 7 should return "1 Bet"
Cards Sequence 2, 2, 10 should return "1 Bet"
Ilian Iliev
@zaken
Nov 01 2016 08:13
@Vijayanandkrishnan switch is correct, your if statement has wrong argument
1 should also bet
else hold
Fernando Sugianto
@fyzz100
Nov 01 2016 08:14

@Manish-Giri Finally passed the challenge,but still,I dont understand why it doesn't work with
arr.push(item);
arr.shift();
return arr.shift();

but anyway THANK YOU SO MUCH!

CamperBot
@camperbot
Nov 01 2016 08:14
fyzz100 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2156 | @manish-giri |http://www.freecodecamp.com/manish-giri
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:14
@dzift sure ok,
scottmike0
@scottmike0
Nov 01 2016 08:15
@abhisekp maybe you can help, but I cannot figure out how servers can find http posts from other websites, is there is specific concept I am missing, I have been researchin this for the past 2 days...
Manish Giri
@Manish-Giri
Nov 01 2016 08:15
@fyzz100
arr.shift(); //this removes the first item from the array but does not return it, from your function
return arr.shift(); //this does both
Fernando Sugianto
@fyzz100
Nov 01 2016 08:16
@Manish-Giri sparks in my brain,I finally understand the concept,thanks a million!
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:16
@dzift
Manish Giri
@Manish-Giri
Nov 01 2016 08:16
@fyzz100 anytime!
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:16
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count +=0 ;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;
break;
}
if (count > 1){
return ""+ count +" Bet";
}
else if(count <1){
return ""+ count +" Hold";
}
scottmike0
@scottmike0
Nov 01 2016 08:16
@abhisekp that has the word cheat in it, u hackin mate
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:17
@scottmike0 lol. yeah! sometimes Life hacks are necessary for survival
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 08:17
@dzift Thanks!
CamperBot
@camperbot
Nov 01 2016 08:17
vijayanandkrishnan sends brownie points to @dzift :sparkles: :thumbsup: :sparkles:
:cookie: 211 | @dzift |http://www.freecodecamp.com/dzift
Ilian Iliev
@zaken
Nov 01 2016 08:17
@Vijayanandkrishnan if you say count > 1, than you assume 1 doesnt bet
scottmike0
@scottmike0
Nov 01 2016 08:17
i see how it is @Vijayanandkrishnan no thankin me
@dzift over here is a browny stealer
lpavanvenkat
@lpavanvenkat
Nov 01 2016 08:17
need help in Make object properties private
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:17

I cannot figure out how servers can find http posts from other websites

@scottmike0 You mean like search engines?

lpavanvenkat
@lpavanvenkat
Nov 01 2016 08:18

here my code
var Bike = function() {
var gear=0;
// Only change code below this line.
this.setGear=function(change){
gear+=change;

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

scottmike0
@scottmike0
Nov 01 2016 08:18
@abhisekp yeah i used search engines, they all brought me to php stuff
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:19
Sorry! I didn't quite get your question @scottmike0
scottmike0
@scottmike0
Nov 01 2016 08:19
@abhisekp I am seein if you can clear it up
@abhisekp okay, lets say I am on a game site, I send a Http post Json Object to my site, how does my site accept it, and find that Json object?
Muliro1
@Muliro1
Nov 01 2016 08:20

i've completed the condense arrays with reduce challenge but it is still unclear to me anyone with a link to a website with a more indepth explanation? var array = [4,5,6,7,8];
var singleVal = 0;

// Only change code below this line.

singleVal = array.reduce(function(previousVal, currentVal){
return previousVal + currentVal;}, 0);

scottmike0
@scottmike0
Nov 01 2016 08:21
that is what I am trying to comprehend
grantknaver
@grantknaver
Nov 01 2016 08:21
function factorialize(num) {
  var answer;
  for (var i = 1; i < num.length; i++) {
    i 
  }


}
do I multiple i by itself or make another for loop to multiply through?
scottmike0
@scottmike0
Nov 01 2016 08:22
@grantknaver factorialize involves numbers not words
@grantknaver and for factorialize, the easiest solution is recursive
Markus Kiili
@Masd925
Nov 01 2016 08:25
@grantknaver Initialize answer to 1.
scottmike0
@scottmike0
Nov 01 2016 08:25
@abhisekp ya better not leave me in the dark here
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:26

I am on a game site, I send a Http post Json Object to my site

@scottmike0 how are you doing that?


how does my site accept it, and find that Json object?

@scottmike0 you run a server which accepts requests and serves response

Manish Giri
@Manish-Giri
Nov 01 2016 08:27
grantknaver
@grantknaver
Nov 01 2016 08:32
Thanks @scottmike0 Im learning about recursive right now
CamperBot
@camperbot
Nov 01 2016 08:32
grantknaver sends brownie points to @scottmike0 :sparkles: :thumbsup: :sparkles:
:cookie: 369 | @scottmike0 |http://www.freecodecamp.com/scottmike0
scottmike0
@scottmike0
Nov 01 2016 08:33
@Manish-Giri but where does it save the json object, is there a file that i can access it from?
Abhisek Pattnaik
@abhisekp
Nov 01 2016 08:35
i'm going to have lunch bye
Aarya Bhorra
@aarya1302
Nov 01 2016 08:39
function titleCase(str) {
str = str.split(" ");
str = str.map(function(val){
val.toUpperCase();
});
return str;
}
it's returning an array of null
Can you guys tell me what's wrong?
Shivam Khandelwal
@chocobuoy
Nov 01 2016 08:39
Anyone completed making their portfolio? kindly share the link i want new ideas :3333
Aarya Bhorra
@aarya1302
Nov 01 2016 08:40
I mad a pretty sloppy one
*made
scottmike0
@scottmike0
Nov 01 2016 08:40
@aarya1302 try commenting out the second str line
@aarya1302 see if it returns null
Aarya Bhorra
@aarya1302
Nov 01 2016 08:41
ok
Just to be clean the one with the .map
?
@chocobuoy not the best portfolio ever but here it is http://codepen.io/aru1302/full/WGqxzm/
Ian
@toianw
Nov 01 2016 08:42
@aarya1302 the nulls are because you're not returning anything from the map callback.
Aarya Bhorra
@aarya1302
Nov 01 2016 08:43
Ohh yess
It works now
Shivam Khandelwal
@chocobuoy
Nov 01 2016 08:43
@aarya1302 its nice
Aarya Bhorra
@aarya1302
Nov 01 2016 08:43
Thanks @toianw and @scottmike0
CamperBot
@camperbot
Nov 01 2016 08:43
aarya1302 sends brownie points to @toianw and @scottmike0 :sparkles: :thumbsup: :sparkles:
:cookie: 407 | @toianw |http://www.freecodecamp.com/toianw
:cookie: 370 | @scottmike0 |http://www.freecodecamp.com/scottmike0
Aarya Bhorra
@aarya1302
Nov 01 2016 08:43
Thanks @chocobuoy
CamperBot
@camperbot
Nov 01 2016 08:43
aarya1302 sends brownie points to @chocobuoy :sparkles: :thumbsup: :sparkles:
:cookie: 239 | @chocobuoy |http://www.freecodecamp.com/chocobuoy
Shivam Khandelwal
@chocobuoy
Nov 01 2016 08:44
@aarya1302 so far I have just managed to write about me somehow :# http://codepen.io/choco_buoy/full/GjVWpB/
@aarya1302 plus I have no idea about nav bar, gotta research about it
Ogundele Olumide
@Lumexralph
Nov 01 2016 08:44
@revisualize you think learning JS and Python a good tool for a career as a GIS Developer?
Aarya Bhorra
@aarya1302
Nov 01 2016 08:45
It's nice @chocobuoy
Shivam Khandelwal
@chocobuoy
Nov 01 2016 08:45
@aarya1302 ty :)
CamperBot
@camperbot
Nov 01 2016 08:45
chocobuoy sends brownie points to @aarya1302 :sparkles: :thumbsup: :sparkles:
:cookie: 239 | @aarya1302 |http://www.freecodecamp.com/aarya1302
Aarya Bhorra
@aarya1302
Nov 01 2016 08:47
@chocobuoy you're not using bootstrap. Try using it and use the container class to make your page more responsive
Shivam Khandelwal
@chocobuoy
Nov 01 2016 08:48
@aarya1302 yeah I will add that at last
Philipp Scholz
@philipp32
Nov 01 2016 08:48
Hey guys, I am having big time problems with the JS challenge "Stand in line" .
function nextInLine(arr, item) {
  // Your code here
  arr= "Philipp"; 
  item = 2;
  var myArray = arr + item;
  var removed = myArray.shift();

  return myArray;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(arr, item));
console.log("After: " + JSON.stringify(testArr));
Ogundele Olumide
@Lumexralph
Nov 01 2016 08:49
@philipp32 what's the challenge?
Philipp Scholz
@philipp32
Nov 01 2016 08:50
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Ogundele Olumide
@Lumexralph
Nov 01 2016 08:52
@philipp32 what are you getting?
Muhammad Hasham
@MohammadHasham
Nov 01 2016 08:54
blob
I know this may sound off topic but why is my upwork account not accepted.I have made changes in category but still
Ogundele Olumide
@Lumexralph
Nov 01 2016 08:55
@philipp32 nextInLine function is to accept two arguments when it's called but anyway, concating arr + item...produces a string
Aarya Bhorra
@aarya1302
Nov 01 2016 08:56
when you arr +item you don't make an array
Ogundele Olumide
@Lumexralph
Nov 01 2016 08:58
@philipp32 strings are immutable, you can't change it, make arr an array and not a string, then push item to the array and you can now use shift() to return the removed first element of the array
D O R C ¥
@Dorcy-ndg3
Nov 01 2016 09:01
guys y wont this pass
function longestWord(string) {
    var str = string.split(" ");
    var longest = 0;
    var word = null;
    for (var i = 0; i < str.length; i++) {
        if (longest < str[i].length) {
            longest = str[i].length;
            word = str[i];
        }
    }
    return word.length;
}

longestWord("The quick brown fox jumped over the lazy dog");
Aarya Bhorra
@aarya1302
Nov 01 2016 09:05
@Dorcy-ndg3 comment the word = str[i];
and instead of word.length return longest
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:06
@Dorcy-ndg3 it outputed 6 when I ran your code, what seems to be the problem, isn't that what you wanted?
@aarya1302 it returned 6 here
Aarya Bhorra
@aarya1302
Nov 01 2016 09:07
But isn't that the right answer
?
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:07
which happens to be "jumped"
D O R C ¥
@Dorcy-ndg3
Nov 01 2016 09:07
thats the answer but it does not pass the test
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:07
@aarya1302 @Dorcy-ndg3 it should be the answer
Aarya Bhorra
@aarya1302
Nov 01 2016 09:07
perhaps it only works with this particular string
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:07
@Dorcy-ndg3 what test is it failing?
Ian
@toianw
Nov 01 2016 09:08
@Dorcy-ndg3 I think it's because you changes the name of the function. Should be findLongestWord
D O R C ¥
@Dorcy-ndg3
Nov 01 2016 09:08
@Lumexralph i did wat u said and it still outputs 6
Aarya Bhorra
@aarya1302
Nov 01 2016 09:08
But @Dorcy-ndg3 the longest variable already contains the correct value
instead of outputting the word variable just output the longest variable
D O R C ¥
@Dorcy-ndg3
Nov 01 2016 09:09
that makes sense @toianw
it has actually passed
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:09
@Dorcy-ndg3 @aarya1302 yeah that's true, longest already contained the longest word but as @toianw maybe it's the function nam you changed
D O R C ¥
@Dorcy-ndg3
Nov 01 2016 09:09
thanks @toianw @aarya1302 @Lumexralph
CamperBot
@camperbot
Nov 01 2016 09:09
dorcy-ndg3 sends brownie points to @toianw and @aarya1302 and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 240 | @aarya1302 |http://www.freecodecamp.com/aarya1302
:cookie: 378 | @lumexralph |http://www.freecodecamp.com/lumexralph
:cookie: 408 | @toianw |http://www.freecodecamp.com/toianw
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:10
forgive FCC....lol @Dorcy-ndg3
@Dorcy-ndg3 you're welcome
Yifang Di
@YvonneD
Nov 01 2016 09:18
Hi . I'm doing the Counting Cards exercise which can't go through. Would guys help me on that?```
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:20
@YvonneD we can try
Yifang Di
@YvonneD
Nov 01 2016 09:20

var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count+=1;
break;
case 7:
case 8:
case 9:
count=0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count-=1;
break;
}
if(count>=0){
return card+" Hold";
}else{
return card+" Bet";
}
return "Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(-3); cc(3); cc(7); cc('K'); cc('A');

Oh my god. first time for helping here. Btw,how to copy the code here?
Stephen James
@sjames1958gm
Nov 01 2016 09:22
@YvonneD you are supposed to return the count not the card
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:22
@YvonneD use ```
Stephen James
@sjames1958gm
Nov 01 2016 09:22
@YvonneD '''
the more info link below has info about posting formatted code
CamperBot
@camperbot
Nov 01 2016 09:22
:bulb: to format code use backticks! ``` more info
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:23
@YvonneD at the beginning and use it to end your code
Yifang Di
@YvonneD
Nov 01 2016 09:24
when I change to count in return part, still error @sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 09:24
@YvonneD The function will then return a string with the current count and the string "Bet" if the count is positive
@YvonneD if count <= 0 return "Hold"
Yifang Di
@YvonneD
Nov 01 2016 09:28
yes,my if part is wrong. But still one left can't go on. "Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"" @sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 09:29
@YvonneD Are you supposed to reset count to zero on 7, 8, 9?
Yifang Di
@YvonneD
Nov 01 2016 09:29
yeah. How can I change that? @sjames1958gm
Stephen James
@sjames1958gm
Nov 01 2016 09:30
@YvonneD don't change count when 7, 8, 9
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 09:30
@scottmike0 Thanks too!
CamperBot
@camperbot
Nov 01 2016 09:30
vijayanandkrishnan sends brownie points to @scottmike0 :sparkles: :thumbsup: :sparkles:
:cookie: 371 | @scottmike0 |http://www.freecodecamp.com/scottmike0
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 09:33
@dzift switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count +=0 ;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;
break;
}
if (count >= 1){
return ""+ count +" Bet";
}
else if(count <= 1){
return ""+ count +" Hold";
}
Yifang Di
@YvonneD
Nov 01 2016 09:33
@sjames1958gm Thanks,finally go through. But if I just put the word "count",it shows "expected an assignment or function call and instead saw an expression",what's that means?
CamperBot
@camperbot
Nov 01 2016 09:33
:star2: 4115 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
yvonned sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Vijayanandkrishnan
@Vijayanandkrishnan
Nov 01 2016 09:33
@YvonneD just did this
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count +=0 ;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;
break;
}
if (count >= 1){
return ""+ count +" Bet";
}
else if(count <= 1){
return ""+ count +" Hold";
}
Stephen James
@sjames1958gm
Nov 01 2016 09:33
@YvonneD You actually don't need the cases for 7, 8, 9
Yifang Di
@YvonneD
Nov 01 2016 09:34
Thanks @Vijayanandkrishnan @sjames1958gm got it
CamperBot
@camperbot
Nov 01 2016 09:34
yvonned sends brownie points to @vijayanandkrishnan and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: yvonned already gave sjames1958gm points
:cookie: 198 | @vijayanandkrishnan |http://www.freecodecamp.com/vijayanandkrishnan
Stephen James
@sjames1958gm
Nov 01 2016 09:34
@YvonneD :+1:
Aljaž Belak Rebozu
@firehyperx
Nov 01 2016 09:36
hello can you help me please I don't understand the use of cameLCase
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:38
@firehyperx do you mean a coding challenge or camelcase?
@firehyperx we're here to help eachother
Yifang Di
@YvonneD
Nov 01 2016 09:40
camelCase is the name which is the combination of several words ,the first letter should be capital to delimit the words. such as thisWordIsInCamelCase @firehyperx
Tchunche Hermann
@Mamiki
Nov 01 2016 09:41
Thanks @Vijayanandkrishnan At the end i've got an answer after two weeks of struggle
CamperBot
@camperbot
Nov 01 2016 09:41
mamiki sends brownie points to @vijayanandkrishnan :sparkles: :thumbsup: :sparkles:
:cookie: 199 | @vijayanandkrishnan |http://www.freecodecamp.com/vijayanandkrishnan
Tchunche Hermann
@Mamiki
Nov 01 2016 09:41
Hello everyone
Marcin
@marpolbr
Nov 01 2016 09:42
Hi @Mamiki
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:42
@firehyperx if you mean how to go about the challenge, then you should break it into steps
Tchunche Hermann
@Mamiki
Nov 01 2016 09:42
i need a help dont know where is my mistake
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:42
@Mamiki hi
Tchunche Hermann
@Mamiki
Nov 01 2016 09:43
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

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

  };


  result = lookup.bravo;



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

// Change this value to test
phoneticLookup("bravo");
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:44
@Mamiki your function is expecting to use val
Nasir Husain
@Nasirilahi
Nov 01 2016 09:44

function palindrome(str) {

str = str.replace(/[&\/\#,+()$~%.'_ ":*?<>{}]/g, '');
str = str.toLowerCase();
for(var i=0, j= str.length-1; i<=j; i++,j--){
if(str[i] != str[j]){
return false;
}
}
return true;
}
palindrome("0_0 (: /-\ :) 0-0");
I have write above code in palindrome function but it is return false "0_0 (: /-\ :) 0-0" string ??

Ogundele Olumide
@Lumexralph
Nov 01 2016 09:45
@Mamiki val should be used in place of result = lookup.bravo
Marcin
@marpolbr
Nov 01 2016 09:45
@Mamiki you should use something like " result = lookup[val];" instead "result = lookup.bravo;"
Tchunche Hermann
@Mamiki
Nov 01 2016 09:45
@Lumexralph it means instead of using lookup i should use val /
Jean Baptiste Kwizera
@jbkwizera
Nov 01 2016 09:46

Hello everyone!
I am wondering wether I can use :

if (!(0<= guess <= 6)) {
}

to mean if guess is not in the interval [0 6] ?

Ogundele Olumide
@Lumexralph
Nov 01 2016 09:46
@Mamiki because the argument val is already like a containing variable which will contain whatever string you provide for your function so it should be result = lookup[val]
Stephen James
@sjames1958gm
Nov 01 2016 09:47
@Nasirilahi You are not removing the -
Nasir Husain
@Nasirilahi
Nov 01 2016 09:48
yes I got it but as i am adding - it showing invalid regular expression so how can i add a - in reg exp ? @sjames1958gm
Ogundele Olumide
@Lumexralph
Nov 01 2016 09:48
@jbkwizera try it out, it won't hurt, you'll learn more afterwards....not sure you can but try it
Stephen James
@sjames1958gm
Nov 01 2016 09:48
@Nasirilahi You need to escape it
Nasir Husain
@Nasirilahi
Nov 01 2016 09:48
yes I did it as /- but still it is not taking @sjames1958gm