These are chat archives for FreeCodeCamp/HelpJavaScript

11th
Aug 2016
Stephen James
@sjames1958gm
Aug 11 2016 00:00
@alhajit21 What is a test that is failing?
@kelifine Add jquery to your javascript settings
Keli Fine
@kelifine
Aug 11 2016 00:02
@sjames1958gm I already did?
Stephen James
@sjames1958gm
Aug 11 2016 00:02
Odd, can you link you codepen here?
Generally it says $ is not defined when jquery is not loaded.
now I'm not getting any message when I do devtools...
but the code still isn't working
Stephen James
@sjames1958gm
Aug 11 2016 00:04
me either
Moisés Man
@moigithub
Aug 11 2016 00:04
@kelifine when u use functions.. there are 2 stages...
declaring.. and calling
Stephen James
@sjames1958gm
Aug 11 2016 00:04
I am see Here in the window
@moigithub :+1:
Moisés Man
@moigithub
Aug 11 2016 00:05
u have declared...

  function requestCurrentPosition() {
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(useGeodata);
    }
  };
but not calling.. so that code never will execute
requestCurrentPosition() ; <-- calling missing
Abis Mal
@abisthecodermal
Aug 11 2016 00:06
so what do I paste in jsbin or repl.it? The entire code? including function xyz(num)??
@moigithub @sjames1958gm
ahmed abouhay
@abohay
Aug 11 2016 00:07
function largestOfFour(arr) {
  var past = 0;
  var last =[] ;
  for ( var i = 0 ; i < arr.length ; i++){
    for ( var j = 0 ; j < arr[i].length; j++){
      if (arr[i][j] > past){
       past = arr[i][j];

      }

    }
         last.push(past);     

  }
  return last;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Abis Mal
@abisthecodermal
Aug 11 2016 00:07
If I paste the function, how is it called?
Stephen James
@sjames1958gm
Aug 11 2016 00:07
@abisthecodermal Everything including any test code. Put console.log(testcall()) then you can see the response.
@abisthecodermal Add test calls at the bottom.
@abohay This passes the first test? but not the second?
Keli Fine
@kelifine
Aug 11 2016 00:08
@moigithub thank you, here's what I have now but it's still not working?
$(document).ready(function(){
 function useGeodata (position) {
   var lat = position.coords.latitude; 
   var long = position.coords.longitude;
  $.getJSON("http://api.openweathermap.org/data/2.5/weather?lat={" + lat + "}&lon={" + long + "}", function(weather) {
     $("h2").text(weather.name);
  });
  };
  function requestCurrentPosition (){
    if (navigator.geolocation) {navigator.geolocation.getCurrentPosition(useGeodata);
  }
  };
  requestCurrentPosition();

});
CamperBot
@camperbot
Aug 11 2016 00:08
kelifine sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1853 | @moigithub |http://www.freecodecamp.com/moigithub
Stephen James
@sjames1958gm
Aug 11 2016 00:08
@kelifine Now you might have errors in the console
Abis Mal
@abisthecodermal
Aug 11 2016 00:08
@kelifine you also need to pass an API key in the URL
Moisés Man
@moigithub
Aug 11 2016 00:08
@abohay u need to re-initialize ur past variable.. else it will hold ur previous subarray largest value
alhajit21
@alhajit21
Aug 11 2016 00:09
@sjames1958gm yes
Stephen James
@sjames1958gm
Aug 11 2016 00:09
@alhajit21 It looks good - which test is failing?
@alhajit21 I see what it is - count your { vs your }
Keli Fine
@kelifine
Aug 11 2016 00:10
@abisthecodermal an API key?
Moisés Man
@moigithub
Aug 11 2016 00:10
@kelifine getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS
from console
Keli Fine
@kelifine
Aug 11 2016 00:11
@moigithub so I should put https:// instead of http?
Stephen James
@sjames1958gm
Aug 11 2016 00:11
@moigithub Are you also on a mac?
Moisés Man
@moigithub
Aug 11 2016 00:11
ye
no @sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 00:11
I wasn't sure if mac chrome was up to the same version as PC where they deprecated getCurrentPosition
Moisés Man
@moigithub
Aug 11 2016 00:12
ahh i dont know either :)
Abis Mal
@abisthecodermal
Aug 11 2016 00:12
@kelifine Yes. appid that should be a part of the URL
alhajit21
@alhajit21
Aug 11 2016 00:12
@sjames1958gm its saying unreachable return after break
Stephen James
@sjames1958gm
Aug 11 2016 00:12
@alhajit21 Your switch statement is missing }
Keli Fine
@kelifine
Aug 11 2016 00:12
@abisthecodermal I changed the api link to https://api etc but I'm still getting the same errors?
Moisés Man
@moigithub
Aug 11 2016 00:13
@kelifine https on ur codepen link
alhajit21
@alhajit21
Aug 11 2016 00:13
i added one return is highligted yellow
Stephen James
@sjames1958gm
Aug 11 2016 00:13
@alhajit21 Between your last break and the return you needed a }
Abis Mal
@abisthecodermal
Aug 11 2016 00:13
@kelifine
check http://openweathermap.org/current. All links have an appid in them...
Jfcorp1
@Jfcorp1
Aug 11 2016 00:14
Hi guys good day, I've been burning the head with an exercise and not decipher what I need, who helps me with the solution is exercise Truncate String code I have is as follows:
ahmed abouhay
@abohay
Aug 11 2016 00:14
@moigithub how
alhajit21
@alhajit21
Aug 11 2016 00:14
@sjames1958gm thanks
CamperBot
@camperbot
Aug 11 2016 00:14
alhajit21 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2488 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 00:14
@abohay After you push your past value reset it to zero
@Jfcorp1 post your code using the following formatting
help format
CamperBot
@camperbot
Aug 11 2016 00:14

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Keli Fine
@kelifine
Aug 11 2016 00:15
@abisthecodermal sorry I'm not understanding, i put https:// in front of the openweather map api link but that didn't work?
@abisthecodermal do I need a different api source?
Abis Mal
@abisthecodermal
Aug 11 2016 00:16

@sjames1958gm @moigithub I copied my function. After the closing braces I included

console.log(convertToRoman(888));

Is this correct?

Robert Richey
@0x0936
Aug 11 2016 00:16
@kelifine openweather does not offer an https API call
ahmed abouhay
@abohay
Aug 11 2016 00:16
@sjames1958gm re intiallization to get the updated one fuck i'm stupid guy
Stephen James
@sjames1958gm
Aug 11 2016 00:17
@abisthecodermal Yes that should call your function and now you can insert console.logs to your hearts content!
Keli Fine
@kelifine
Aug 11 2016 00:17
@0x0936 so how do I get around the devtools problem?
Stephen James
@sjames1958gm
Aug 11 2016 00:17
@abohay It happens, don't beat yourself up.
Abis Mal
@abisthecodermal
Aug 11 2016 00:18
appid is a set of random characters which you need to obtain from openweather. Each application or web application needs to have an appid
King Mhar Bayato
@kirahmadlare
Aug 11 2016 00:18
Hi, i am making the show the local weather challenge however, when I try to use the example geolocation code is not working in codepen? is there any API that I need to use?
Robert Richey
@0x0936
Aug 11 2016 00:18
@kelifine @abisthecodermal mentioned you need to add appid as a query parameter to the API call :point_up: August 10, 2016 6:08 PM
Jfcorp1
@Jfcorp1
Aug 11 2016 00:18
Hi guys good day, I've been burning the head with an exercise and not decipher what I need, who helps me with the solution is exercise Truncate String code I have is as follows:
function truncateString(str, num){ var truncate = ""; if(str.length > num){ truncate = str.slice(0,num-3) + "..."; return truncate } return str; } truncateString("A-tisket a-tasket A green and yellow basket", 11);
Abis Mal
@abisthecodermal
Aug 11 2016 00:18
Oh! @sjames1958gm. Thanks
CamperBot
@camperbot
Aug 11 2016 00:18
abisthecodermal sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2489 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 00:19
@Jfcorp1 You are not fulfilling all the requirements. Seem to recall something about num less than or equal to 3?
Abis Mal
@abisthecodermal
Aug 11 2016 00:20
@kirahmadlare geolocation works in codepen. If not you can get lat and long from ipinfo
Stephen James
@sjames1958gm
Aug 11 2016 00:20
@Jfcorp1 That code looks like it will satisfy some of the tests? do some pass?
Keli Fine
@kelifine
Aug 11 2016 00:20
@0x0936 thanks, how do i do that?
CamperBot
@camperbot
Aug 11 2016 00:20
kelifine sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star2: 1656 | @0x0936 |http://www.freecodecamp.com/0x0936
King Mhar Bayato
@kirahmadlare
Aug 11 2016 00:21

@abisthecodermal

<script>
var x = document.getElementById("demo");
function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}
function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude; 
}
</script>

this is my code

Robert Richey
@0x0936
Aug 11 2016 00:21
@kelifine do you have an API key from openweather?
Stephen James
@sjames1958gm
Aug 11 2016 00:21
@kelifine you can also use $.getJSON to get location from http://ip-api.com/json
Keli Fine
@kelifine
Aug 11 2016 00:23
@0x0936 no I don't, this is my first time trying to use an API so I have no idea what I'm doing
Robert Richey
@0x0936
Aug 11 2016 00:23
@kelifine all calls to the openweather API require an API key which you can get here: http://openweathermap.org/appid and it shows examples of how to make the API call with your key
Jfcorp1
@Jfcorp1
Aug 11 2016 00:24
@sjames1958gm satisfies almost all
Keli Fine
@kelifine
Aug 11 2016 00:25
@0x0936 Thank you so so much
CamperBot
@camperbot
Aug 11 2016 00:25
kelifine sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:warning: kelifine already gave 0x0936 points
Stephen James
@sjames1958gm
Aug 11 2016 00:25
@Jfcorp1 Specifically which ones are in error - knowing that can help deterimine the error. Possibly the ones where num <= 3?
@kelifine Maybe rewatch the project video, it talks about needing an api key as well.
Abis Mal
@abisthecodermal
Aug 11 2016 00:27
$.getJSON("http://ipinfo.io/json",function(ipdata){
coords=ipdata.loc;
});
@kirahmadlare
use this to get IP coordinates.
King Mhar Bayato
@kirahmadlare
Aug 11 2016 00:27
@abisthecodermal thanks
CamperBot
@camperbot
Aug 11 2016 00:27
kirahmadlare sends brownie points to @abisthecodermal :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @abisthecodermal |http://www.freecodecamp.com/abisthecodermal
Abis Mal
@abisthecodermal
Aug 11 2016 00:28
@kelifine did you find what you were looking for?
Jfcorp1
@Jfcorp1
Aug 11 2016 00:29
@sjames1958gm by putting num <= 3 me solves one but the rest does not meet
Abis Mal
@abisthecodermal
Aug 11 2016 00:29

@sjames1958gm . Within the function, I inserted this

//convert to string so as to calculate the no. of digits
      x=num.toString().length;
      console.log(x);

The console is blank

Stephen James
@sjames1958gm
Aug 11 2016 00:29
@Jfcorp1 Well you have to do it such that you don't break the old code - post what you have.
Keli Fine
@kelifine
Aug 11 2016 00:30
@abisthecodermal I've got an API key but I'm not quite sure where to put it and google isn't helping much..?
Abis Mal
@abisthecodermal
Aug 11 2016 00:30
ok please wait @kelifine
Jfcorp1
@Jfcorp1
Aug 11 2016 00:31

```function truncateString(str, num) {
var truncate = '';
if (str.length > num) {
truncate = str.slice(0,num-3) + '...';
return truncate;
}
return str;
}

truncateString("A-tisket a-tasket A green and yellow basket", 11);```

Abis Mal
@abisthecodermal
Aug 11 2016 00:31
do you provide coordinates to openweather API?
@kelifine
Mateusz Szymański
@matszym
Aug 11 2016 00:31

@sjames1958gm

SSL access is restricted to paid plans. See http://ipinfo.io/pricing for more details, or contact us via http://ipinfo.io/contact

Oh well... :(

Stephen James
@sjames1958gm
Aug 11 2016 00:32
@matszym yeah, I think that for a real app you would have https:// at both ends, for this http:// is sufficent.
Keli Fine
@kelifine
Aug 11 2016 00:32
@abisthecodermal yes I put latitude and longitude in the API link in my jquery
@abisthecodermal is that what you meant?
Abis Mal
@abisthecodermal
Aug 11 2016 00:33
Yes, great... now your URL must look something like this
http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=b1b15e88fa797225412429c1c50c122a
@kelifine
Stephen James
@sjames1958gm
Aug 11 2016 00:33
@Jfcorp1 So you need a check for num <= 3 inside your if and do the same if it isn't and add different code if it is.
@matszym But if you are using https:// just use getCurrentPosition from the browser
Abis Mal
@abisthecodermal
Aug 11 2016 00:34
if it doesn't, this is the json data you get
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
Mateusz Szymański
@matszym
Aug 11 2016 00:34

@sjames1958gm I hoped it could be versatile, so we could call

$.getJSON("//ipinfo.io/json",function(ipdata){
});

Nvm, all hope lost :D

Stephen James
@sjames1958gm
Aug 11 2016 00:34
@matszym Ah, interesting.
Abis Mal
@abisthecodermal
Aug 11 2016 00:34
now, as @0x0936 mentioned sign up and get an API key
@kelifine
Keli Fine
@kelifine
Aug 11 2016 00:35
@abisthecodermal ok this is what I've got now, I got an api key and added it:
"http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + long + "&appid=a4767e99683bb5a999e0411efc6ebfc8
"
Jfcorp1
@Jfcorp1
Aug 11 2016 00:35
thanks @sjames1958gm I'll try
CamperBot
@camperbot
Aug 11 2016 00:35
jfcorp1 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2490 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken HIll
@hillk8
Aug 11 2016 00:35
Hi All. I am stuck on "Using Objects for Lookups". I can't understand how to use the variable "val". Thanks
Abis Mal
@abisthecodermal
Aug 11 2016 00:35
Good job!! This should work... @kelifine
Stephen James
@sjames1958gm
Aug 11 2016 00:36
@hillk8 Remember the challenge with playerNumber that showed how to use a variable and an object.
Ken HIll
@hillk8
Aug 11 2016 00:36
OOOO. . notation or brackets right?
Keli Fine
@kelifine
Aug 11 2016 00:36
@abisthecodermal it's saying unexpected token illegal?
Stephen James
@sjames1958gm
Aug 11 2016 00:36
@hillk8 yes - brackets.
Joseph
@revisualize
Aug 11 2016 00:37
Hi.
:P
:wave:
Stephen James
@sjames1958gm
Aug 11 2016 00:38
@revisualize Evening I see you peeking in from the side of your picture
Joseph
@revisualize
Aug 11 2016 00:38
@sjames1958gm Thanks for everything you do.
CamperBot
@camperbot
Aug 11 2016 00:38
revisualize sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2491 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 00:38
@revisualize yw.
Keli Fine
@kelifine
Aug 11 2016 00:38
@abisthecodermal ok i fixed that but I'm still getting the https error message in the console?
Joseph
@revisualize
Aug 11 2016 00:38
That picture was taken at the Amazon Conference Center. It is on all the emergency exits.
Abis Mal
@abisthecodermal
Aug 11 2016 00:39
@kelifine link to your pen??
Ken HIll
@hillk8
Aug 11 2016 00:39
How do I post my code?
Keli Fine
@kelifine
Aug 11 2016 00:39
Joseph
@revisualize
Aug 11 2016 00:39
help format
CamperBot
@camperbot
Aug 11 2016 00:39

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Keli Fine
@kelifine
Aug 11 2016 00:39
@abisthecodermal I've tried it both http: and https:
Joseph
@revisualize
Aug 11 2016 00:40
```js [SHIFT+ENTER]
// your code here
```[CTRL+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 ~.
Ken HIll
@hillk8
Aug 11 2016 00:40
// 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"
  };

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

// Change this value to test
phoneticLookup(lookup.alpha);
I am having a hard time wrapping my head around this
Stephen James
@sjames1958gm
Aug 11 2016 00:41
@hillk8 in your test just put the string for the property. Then in your function set result to the property in val on the object lookup
Joseph
@revisualize
Aug 11 2016 00:42
@hillk8 You're setting result to "" at the beginning of your code.. Not modifying result then returning it.
Mateusz Szymański
@matszym
Aug 11 2016 00:42
Jfcorp1
@Jfcorp1
Aug 11 2016 00:43
var testCode = "";
//This is a test
Stephen James
@sjames1958gm
Aug 11 2016 00:43
@Jfcorp1 :)
Joseph
@revisualize
Aug 11 2016 00:43
:+1:
Robert Richey
@0x0936
Aug 11 2016 00:44
@kelifine because you're using geolocation, which requires https, so all other resources must also be requested over https. openweather doesn't support https API calls, and they don't seem to support a JSONP response. You can either send your openweather API call through an https proxy server or use a different weather API that supports https API calls - like forecast.io
// notice the prefixed https proxy server
"https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + long + "&appid=a4767e99683bb5a999e0411efc6ebfc8"
Ken HIll
@hillk8
Aug 11 2016 00:44
@revisualize What and where should it be set to?
lookup?
Joseph
@revisualize
Aug 11 2016 00:45
You should be returning the property of your lookup object.
Ken HIll
@hillk8
Aug 11 2016 00:45
Besides it says I am not to change that code
Keli Fine
@kelifine
Aug 11 2016 00:45
@0x0936 you're brilliant thank you thank you thank you
CamperBot
@camperbot
Aug 11 2016 00:45
kelifine sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:warning: kelifine already gave 0x0936 points
Joseph
@revisualize
Aug 11 2016 00:45
That's correct.
Stephen James
@sjames1958gm
Aug 11 2016 00:45
@hillk8 After your object definition
var player = testObj[playerNumber]; // Change this Line this is the challenge I was talking about
@hillk8 right above the only change above this line line
Joseph
@revisualize
Aug 11 2016 00:46
@hillk8 You shouldn't change that code. You should be reassigning the result variable to be the property of your lookup object.
Keli Fine
@kelifine
Aug 11 2016 00:46
@moigithub thank you for all your help too, and @sjames1958gm
CamperBot
@camperbot
Aug 11 2016 00:46
kelifine sends brownie points to @moigithub and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2492 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:warning: kelifine already gave moigithub points
Stephen James
@sjames1958gm
Aug 11 2016 00:46
@kelifine good luck - blame chrome they just recently change getCurrentPosition to require https://
Joseph
@revisualize
Aug 11 2016 00:47
@sjames1958gm 8 more!
:P
Stephen James
@sjames1958gm
Aug 11 2016 00:47
@revisualize I know :)
Joseph
@revisualize
Aug 11 2016 00:47
I need like 4 more or something.
Okay! I need a new challenge to make a gist for.
Jordan Shackelford
@JordanShackelford
Aug 11 2016 00:48
hello I am trying to rotate my canvas around a fixed point, in this case the center
Joseph
@revisualize
Aug 11 2016 00:48
Thoughts?
Jordan Shackelford
@JordanShackelford
Aug 11 2016 00:48
I have it so that these 3 statements run when the user presses right arrow key
Ken HIll
@hillk8
Aug 11 2016 00:48

// 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[alpha];
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup(lookup);
Stephen James
@sjames1958gm
Aug 11 2016 00:48
@revisualize People have trouble with nesting for loops.
llamatarianism
@llamatarianism
Aug 11 2016 00:48

@revisualize sknaht

CamperBot @camperbot

llamatarianism removes brownie points from @revisualize :boom: :-1: :boom:
:fire: 0 | @revisualize | http://www.freecodecamp.com/revisualize

Joseph
@revisualize
Aug 11 2016 00:49
@hillk8 CLOSE!
Jordan Shackelford
@JordanShackelford
Aug 11 2016 00:49
context.translate(a_canvas.width / 2, a_canvas.height / 2); 
context.rotate(1*Math.PI/180);
context.translate(0,0);
Stephen James
@sjames1958gm
Aug 11 2016 00:49
@hillk8 What happened to wanting to use val?
Joseph
@revisualize
Aug 11 2016 00:49
@hillk8 the variable you should be using is the parameter passed into the function.
@llamatarianism That's awesome.
FRESH START!
Let's do this!
Ken HIll
@hillk8
Aug 11 2016 00:50

// 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[alpha];
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup(alpha);
closer?
Joseph
@revisualize
Aug 11 2016 00:50
No.
Stephen James
@sjames1958gm
Aug 11 2016 00:51
@hillk8 Remember your first question was how to use val????
Joseph
@revisualize
Aug 11 2016 00:51
result = lookup[alpha]; Wrong variable.
Ken HIll
@hillk8
Aug 11 2016 00:51
shouldnt I use val somewhere in the function?
Joseph
@revisualize
Aug 11 2016 00:51
@hillk8 YES!
Stephen James
@sjames1958gm
Aug 11 2016 00:51
@hillk8 I feel like that is where we started :)
Joseph
@revisualize
Aug 11 2016 00:52
You haven't set an alpha variable in your function.
Ken HIll
@hillk8
Aug 11 2016 00:52
Sorry. I am so confused

// 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[val];
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup(alpha);
Joseph
@revisualize
Aug 11 2016 00:52
YAY!
llamatarianism
@llamatarianism
Aug 11 2016 00:52

@revisualize cthulhu fhtagn

CamperBot @camperbot

llamatarianism banishes @revisualize's brownie points to the 5th world :volcano: :fu: :volcano:
:sob: -\infty | @revisualize | http://www.freecodecamp.com/revisualize

there, now you can never gain brownie points ever again
Ken HIll
@hillk8
Aug 11 2016 00:52
but it stil wont work
Joseph
@revisualize
Aug 11 2016 00:52
SWEET! Do I get a shirt?
Stephen James
@sjames1958gm
Aug 11 2016 00:53
@hillk8 Your test needs "alpha" not alpha (the second is an undefined variable)
Joseph
@revisualize
Aug 11 2016 00:53
@hillk8 phoneticLookup(alpha); should be a string that is passed into the function.
You're currently passing a variable.
var alpha hasn't been defined.
Ken HIll
@hillk8
Aug 11 2016 00:53

// 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[val];
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("alpha");
got it
Joseph
@revisualize
Aug 11 2016 00:53
:)
Stephen James
@sjames1958gm
Aug 11 2016 00:53
Brazil v. Denmark just about to start.
Ken HIll
@hillk8
Aug 11 2016 00:54
thank you @revisualize
CamperBot
@camperbot
Aug 11 2016 00:54
hillk8 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1597 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Aug 11 2016 00:54
3 more!
:P
Ken HIll
@hillk8
Aug 11 2016 00:54
@sjames1958gm Thank you
CamperBot
@camperbot
Aug 11 2016 00:54
hillk8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2493 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 00:54
7 more :)
Mateusz Szymański
@matszym
Aug 11 2016 00:54
@sjames1958gm resist the temptation. We have cookies
Joseph
@revisualize
Aug 11 2016 00:54
heheh...
OH! My bus stop is about to hit. ...
Stephen James
@sjames1958gm
Aug 11 2016 00:55
@matszym Cookies, cookies I like cookies :)
revisualize @revisualize is afk. :busstop: :v:
Abis Mal
@abisthecodermal
Aug 11 2016 00:56

This is possible??!??

@revisualize sknaht

CamperBot @camperbot

llamatarianism removes brownie points from @revisualize :boom: :-1: :boom:
:fire: 0 | @revisualize | http://www.freecodecamp.com/revisualize

llamatarianism
@llamatarianism
Aug 11 2016 00:57
yes definitely yes absolutely
it's 100% possible
Stephen James
@sjames1958gm
Aug 11 2016 00:57
about @revisualize
CamperBot
@camperbot
Aug 11 2016 00:57
:star2: 1597 | @revisualize |http://www.freecodecamp.com/revisualize
Abis Mal
@abisthecodermal
Aug 11 2016 00:58
Thanks @llamatarianism
CamperBot
@camperbot
Aug 11 2016 00:58
abisthecodermal sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:star2: 1158 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
Abis Mal
@abisthecodermal
Aug 11 2016 00:58
sknath @llamatarianism
sknaht @llamatarianism
huh !! didn't work!!
@llamatarianism sknaht
andercodder
@andercodder
Aug 11 2016 00:59
hello guys
i need a help
Abis Mal
@abisthecodermal
Aug 11 2016 01:00
still didn't work
Sure @andercodder
andercodder
@andercodder
Aug 11 2016 01:00
please somebody
Abis Mal
@abisthecodermal
Aug 11 2016 01:00
Please state your problem and paste your code
andercodder
@andercodder
Aug 11 2016 01:01
so i am in javaScript session but i can not resolve the challenge to fix to celsius to fahrenheit

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

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

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

and it has multiple options like convert ToF(-30) should return a value of -22
Abis Mal
@abisthecodermal
Aug 11 2016 01:03
not being condescending or anything. But please write the formula for conversion from celsius to fahrenheit
just the formula @andercodder
andercodder
@andercodder
Aug 11 2016 01:03
ok
Joseph
@revisualize
Aug 11 2016 01:03
@andercodder What is the formula for converting Celsius to Fahrenheit?
Rakesh Kumar
@infinitasweb
Aug 11 2016 01:04
@andercodder fahrenheit = celsius * 9 .0 / 5 + 32;
Joseph
@revisualize
Aug 11 2016 01:04
OR WE can just give away answers?
andercodder
@andercodder
Aug 11 2016 01:04
9 /5 +32
Joseph
@revisualize
Aug 11 2016 01:04
Because that's really helping people learn?
Abis Mal
@abisthecodermal
Aug 11 2016 01:04
@infinitasweb we do not serve solutions on platter. Instead we ask people to explore
andercodder
@andercodder
Aug 11 2016 01:05
yes i want help not answer @revisualize
Rakesh Kumar
@infinitasweb
Aug 11 2016 01:05
@abisthecodermal Correct. Will move that way....
Abis Mal
@abisthecodermal
Aug 11 2016 01:05
Things people do for a fuckin cookie
Joseph
@revisualize
Aug 11 2016 01:05
@andercodder That isn't quite the correct formula
socratic method of teaching
andercodder
@andercodder
Aug 11 2016 01:06
ok
Joseph
@revisualize
Aug 11 2016 01:06
@andercodder That's part of it.
Abis Mal
@abisthecodermal
Aug 11 2016 01:07
what you need to do to "Celsius" in order to convert it into fahrenheit??? @andercodder
andercodder
@andercodder
Aug 11 2016 01:07
ok i got it indeed i know already what i did wrong
Abis Mal
@abisthecodermal
Aug 11 2016 01:08
nice!! @andercodder
:clap: :clap: :clap:
so what went wrong?
andercodder
@andercodder
Aug 11 2016 01:08
i was just writing 9 / 5 + 32 without the var celsius itself
Abis Mal
@abisthecodermal
Aug 11 2016 01:08
:clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:
andercodder
@andercodder
Aug 11 2016 01:09
thank you all
i need to be more focused
Abis Mal
@abisthecodermal
Aug 11 2016 01:09
I missed it by that much @revisualize
Now that i have your undivided attention, I need your help in Roman Numeral converter
@revisualize
estnimbus
@estnimbus
Aug 11 2016 01:11
anybody knows about "using object for look up" answer
Abis Mal
@abisthecodermal
Aug 11 2016 01:11
yes lot of us do. How can we help? @estevenimbus
estnimbus
@estnimbus
Aug 11 2016 01:12

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

// Only change code below this line
var lookup = {

 "alpha":"Adams",

  "bravo":"Boston",

  "charlie":"Chicago",

  "delta":"Denver",

  "echo":"Easy",

  "foxtrot":"Frank",

};

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

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

That is what my code look like @abisthecodermal
Diego Mayer
@Chrono79
Aug 11 2016 01:13

@estevenimbus you need to use lookup and val to set result value,

// Only change code below this line

You can't use lookup before declaring it

Stephen James
@sjames1958gm
Aug 11 2016 01:14
@estevenimbus Remember a previous challenge using var for accessing properties? var player = testObj[playerNumber];
Jacob Stewart
@JacobStewart1
Aug 11 2016 01:21
@sjames1958gm thanks for that catch but it still doesn't take my search do you have any recommendations on getting itto work https://codepen.io/JacobStewart1/pen/dXgNzw
CamperBot
@camperbot
Aug 11 2016 01:21
jacobstewart1 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2494 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Robert Richey
@0x0936
Aug 11 2016 01:23
neat. TIL that JS supports variable assignment inside function calls.
function log(msg) {
  console.log(msg);
}

var str = '';
log(str = 'apple'); // console prints 'apple'
Stephen James
@sjames1958gm
Aug 11 2016 01:23
@JacobStewart1 make sure you connect to codepen with http:// (not https://) or the API call wont work (cannot go to http:// from https:// site)
Jacob Stewart
@JacobStewart1
Aug 11 2016 01:24
oh ok thanks
Moisés Man
@moigithub
Aug 11 2016 01:24
@JacobStewart1 if u check devtools console.. u should be able to see the err
Jacob Stewart
@JacobStewart1
Aug 11 2016 01:25
ok thanks
Stephen James
@sjames1958gm
Aug 11 2016 01:26
@JacobStewart1 Your jquery to pull the data out of the input is returning undefined so you aren't getting the srsearch parameter.
Jacob Stewart
@JacobStewart1
Aug 11 2016 01:27
ok
Stephen James
@sjames1958gm
Aug 11 2016 01:27
Use $("#myText").val()
Jacob Stewart
@JacobStewart1
Aug 11 2016 01:28
ok thanks
x981
@x981
Aug 11 2016 01:35
@kirahmadlare Post your codepen.
John Magee
@jemagee
Aug 11 2016 01:36
Sigh - back to the smallest common multiple exercise
Karolee
@KaroleeC
Aug 11 2016 01:36
looking for some help on algorithm challenge Caesars Cipher. Any one available to help with this?
John Magee
@jemagee
Aug 11 2016 01:36
and phooey - the exercise wasn't saved on what i did earlier today - bummer
@KaroleeC What have you tried already?
I know how I did it but I think i did it weird :)
Karolee
@KaroleeC
Aug 11 2016 01:37
@jemagee here is my code so far:

function rot13(str) { // LBH QVQ VG!
var strArray = str.split("");
var codedArray = [];
var finalStr = "";
// for each item in strArray
for(var i in strArray){
// if string !== " ", "." or "!" then
//return its unicode pulse 13
// else return unicode
if (strArray[i] !== " ",".","!") {
var charCode = (strArray[i].charCodeAt(0) - 65 + 13) % 26 + 65;
codedArray.push(charCode);

    }else {
     var simCode = strArray[i].charCodeAt();
      codedArray.push(simCode);
    }

}
//change code back into letters

finalStr = String.fromCharCode.apply(String, codedArray);
return finalStr;

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

John Magee
@jemagee
Aug 11 2016 01:38
@KaroleeC Ok - looking at the psuedo code - you have an issue in you if where you are returning things - returning leaves the function - you don't want to return that value you want to....do what with it?
I won't be much help as I did it an entirely diffrent way and I don't think I've run into anyone else who did it that way :)
Karolee
@KaroleeC
Aug 11 2016 01:40
@jemagee =/ great I am unique (sarcasm). As far as I can tell it works but my spaces are returning as "-" instead of " ".
John Magee
@jemagee
Aug 11 2016 01:42
your math seems pretty complicated - as most letters in the charCode I read were separated by 13 - can't you just if it's a-l add 13, m-z subtract 13?
Karolee
@KaroleeC
Aug 11 2016 01:43
@jemagee yeah I think you are right. I will adjust that and see if simplifying it helps.
Zachary Taylor
@taylorz0917
Aug 11 2016 01:43

function diffArray(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  newArr = arr1.filter(function (value){
    for(var i = 0; i< arr2.length; i++){
      if(arr2.indexOf(value) == -1){
        return true;
      }
      else{
        return false;
      }
    }
  });

  return newArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
`
can someone help me understand why this is returning an empty array, but when I switch the true and false I get the opposite of what I want as my output.
Stephen James
@sjames1958gm
Aug 11 2016 01:47
@taylorz0917 You don't need the inner for loop (your indexOf does the search on arr2).
The reason you get an empty array is all of arr1 is in arr2. You need to also check the other direction.
John Magee
@jemagee
Aug 11 2016 01:47
@taylorz0917 why are you looping through arr2 if you're never accessing it?
Zachary Taylor
@taylorz0917
Aug 11 2016 01:48
Okay, thank you. My mistake makes much more sense now,
Stephen James
@sjames1958gm
Aug 11 2016 01:48
@taylorz0917 To reduce the code size (after removing the for loop) return arr2.indexOf(value) === -1
Zachary Taylor
@taylorz0917
Aug 11 2016 01:50
I got it correct now :) Thanks, I'll do that. That's even less lines of code good recommendation @sjames1958gm
CamperBot
@camperbot
Aug 11 2016 01:50
taylorz0917 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2495 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 01:51
@taylorz0917 You were confused because your code was working :)
Arin
@arinarjani
Aug 11 2016 01:51
This message was deleted
John Magee
@jemagee
Aug 11 2016 01:52
by the way - an exercise that i have to spend 30 minutes just figuring out how to accurately calculate the smallest common multiple since the page they linked me to doesn't really talk about breaking down to primes and eliminating duplicated primes isn't helpful - i'm just say
Zachary Taylor
@taylorz0917
Aug 11 2016 01:54
Haha I started a C++/Java programmer, so some of these commands in web dev are awesome! It reduces quite a few lines of code.
Ujjwal Nambiar
@UjjwalNambiar
Aug 11 2016 01:58
I've just started the 'Factorialize a Number' challenge, and I've gotten nowhere after an hour. Any tips?
emmantek
@emmantek
Aug 11 2016 01:58
Hi everyone, I'm working on a church project, and looking at a similar website i want to model ours after i find out the developer used something like /CSS Global / then type <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"> what does the assets/plugins mean ?
John Magee
@jemagee
Aug 11 2016 01:59
@UjjwalNambiar Do you have any code you can show us?
Sabrina Ferguson
@itsacoyote
Aug 11 2016 02:00
@emmantek they have organized their directories in their project to better organize the many files they are using in the project. assets/plugins is just pointing to the directory, bootstrap is the name of the library they're using.
For example they may also have assets/personal for their own styling. Assets directory is a good way to hold all general styling and scripts for a website you are working on.
In assets/ they may have plugins/, vendor/, library/, styling/, javascript/, sourcemaps/, etc
emmantek
@emmantek
Aug 11 2016 02:01
thank you @itsacoyote
CamperBot
@camperbot
Aug 11 2016 02:01
emmantek sends brownie points to @itsacoyote :sparkles: :thumbsup: :sparkles:
:cookie: 342 | @itsacoyote |http://www.freecodecamp.com/itsacoyote
John Magee
@jemagee
Aug 11 2016 02:01
sigh - another step down in smallest multiple
now the hard part :)
John
@raineyjt
Aug 11 2016 02:06
I need some help with the code for converting Celsius to Fahrenheit! @Camperbot
John Magee
@jemagee
Aug 11 2016 02:06
@raineyjt what have you tried so far?
John
@raineyjt
Aug 11 2016 02:07

A few things, I can't seem to get the syntax correct, if /else statements, and I don't really understand how I pick up the variable initially @jemagee, here is a rough copy of where I am.code below this line
For (var F; )
if (fahrenheit = (0)

  return 32;)
else fahrenheit *=5/9 +=32;

// Only change code

John Magee
@jemagee
Aug 11 2016 02:09
@raineyjt I'm not sure you can use the short cuts like that - does it work if you write the math out 'long hand'?
John
@raineyjt
Aug 11 2016 02:11
I was worried that it wouldn't work due to the numerator being zero but I'm just realizing that would be fine as long as the denominator wasn't 0...
Stephen James
@sjames1958gm
Aug 11 2016 02:11
@raineyjt You don't need any if just use the celsius value passed in the function and plug it into the formula F = C * 9/5 +32
John
@raineyjt
Aug 11 2016 02:12
@jemagee and no it doesn't.
John Magee
@jemagee
Aug 11 2016 02:12
@raineyjt how do you tell a function to return an answer on screen?
John
@raineyjt
Aug 11 2016 02:14
@jemagee :) i don't know.
Stephen James
@sjames1958gm
Aug 11 2016 02:14
@UjjwalNambiar You can use a loop from 1 to the number and build up a product of those numbers.
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:15
hello I need help with random number generator
Stephen James
@sjames1958gm
Aug 11 2016 02:16
@JordanShackelford post what you have
John
@raineyjt
Aug 11 2016 02:16
@jemagee Fahrenheit = celsius *9/5 +32?
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:16
I have a function that runs thousands of times and each time I need it to randomly do one of 3 things
Stephen James
@sjames1958gm
Aug 11 2016 02:16
@JordanShackelford create a random number from 0-2 and just case 0: case 1: case 2:?
John
@raineyjt
Aug 11 2016 02:17
random -.9
John Magee
@jemagee
Aug 11 2016 02:17
@raineyjt you're missing a very key word - look at the first half of your if statement - how do you get 32 to be given as the answer?
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:17
the percent chance for each outcome will be different each time i run it
Stephen James
@sjames1958gm
Aug 11 2016 02:18
@JordanShackelford So not a 1/3 chance?
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:18
nope
Edward Huang
@edwardGunawan
Aug 11 2016 02:18
Hi Guys, I have a questions about react eventHandler. How do you get the href that is passed in from a anchor tag? For instance , if I want to render <a href="#"+name ref ={name} onClick={this.handleClick} className="mdl-tabs__tab is-active">{name}</a> is the onClick the right event listener, and how can I refer to the id that is tagged in href from the call back function? Will it be e.target.value? I am new to React Thanks!
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:18
they all add up to 9. first outcome may be 2/9 chance, 2nd outcome 3/9 chance, 3rd outcome 4/9 chance
then next iteration it may be first outcome 3/9, 2nd 6/9, 3rd 0/9
Stephen James
@sjames1958gm
Aug 11 2016 02:19
@edwardGunawan e.target is the element - you should be able to get the href from the html element.
John Magee
@jemagee
Aug 11 2016 02:20
@JordanShackelford if it always adds up to 9 - can't you just do two iterations and subtract that total from 9?
John
@raineyjt
Aug 11 2016 02:20
@jemagee I would type if c=0 then return 32;
but that didn't work.
John Magee
@jemagee
Aug 11 2016 02:21
@raineyjt just focus on the word(s) you used to get 32 - think about it - there's a wrod missing in your else statement -
Ok - so now it's back to regular enter ?
Stephen James
@sjames1958gm
Aug 11 2016 02:21
@raineyjt What does all your code look like now?
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:21
When I only had 2 outcomes possible I could do if(Math.random() === 2/9) { firstOutcome() } else { secondOutcome() };
John
@raineyjt
Aug 11 2016 02:22

I erased everything and I have this :
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

Fahrenheit = celsius*9/5+32;}

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

Stephen James
@sjames1958gm
Aug 11 2016 02:23
@JordanShackelford Can't you create a random number from 0-8 and then if number < 2 {} else if number < 5 {} else {}
@raineyjt reset the code - you deleted a line that you needed and make sure you use the right case fahrenheit is not Fahrenheit
John Magee
@jemagee
Aug 11 2016 02:25
@raineyjt 1. Variables are case sensitive - two - unless you use the word return a function won't give a result
John
@raineyjt
Aug 11 2016 02:26
@jemagee and i think @camperbot ? Thanks!
CamperBot
@camperbot
Aug 11 2016 02:26
raineyjt sends brownie points to @jemagee and @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 2183 | @camperbot |http://www.freecodecamp.com/camperbot
:cookie: 297 | @jemagee |http://www.freecodecamp.com/jemagee
John Magee
@jemagee
Aug 11 2016 02:27
great - now someone help me with the damn smallest common multiple method when you're only left with 'non primes' - the logic (psuedo code) is escaping me
x981
@x981
Aug 11 2016 02:27
i'm at https://www.freecodecamp.com/challenges/exact-change challenge, Can you help me explain this. What does ["PENNY", 1.01] mean? Is that the total value of all the pennies?
John
@raineyjt
Aug 11 2016 02:27
I will :)
John Magee
@jemagee
Aug 11 2016 02:28
@x981 I think so yes
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:30
Oh I got it.
var rand = Math.random();
if(rand < firstOutcomeChance) firstOutcome();
else if(rand < firstOutcomeChance + secondOutcomeChance) secondOutcome();
else thirdOutcome();
Edward Huang
@edwardGunawan
Aug 11 2016 02:31

@sjames1958gm this is my code

var React = require('react');
var PropTypes = React.PropTypes;

var Nav = React.createClass({
componentDidUpdate: function() {
componentHandler.upgradeDom();
},
componentDidMount: function() {
componentHandler.upgradeDom();
},
handleClick: function(e){
console.log(e.target.refs.value);
},
render: function() {
var tabNames = this.props.map((name,index) => {
if(index === 1){
<a href="#"+name ref ={name} onClick={this.handleClick} className="mdl-tabs__tab is-active">{name}</a>
} else{
<a href="#"+name ref={name} onClick={this.handleClick} className="mdl-tabs__tab">{name}</a>
}
}
});
return (
<div className="mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
<div className="mdl-tabs__tab-bar">
{tabNames}
</div>
</div>
);
}

});

module.exports = Nav;

// <a href="#control" className="mdl-tabs__tab is-active">Control</a>
// <a href="#pendingJobs" className="mdl-tabs__tab">Pending Jobs</a>
// <a href="#printHistory" className="mdl-tabs__tab">Print History</a>

I don't know how to connect href to handleClick or I don't know whether this is the right way of doing the eventListener for anchor tag

Chad Powell
@cjpowellaz
Aug 11 2016 02:32
for "Title Case a Sentence" exercise, I can get to the first letter of the first array, now how can I get to the other strings in the array?

function titleCase(str) {
var strSplit = str.split(" ");

for (var x = 0; x < strSplit.length; x++) {
var caseChange = str.substr(0, 1).toUpperCase();
return caseChange;
}
}

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

x981
@x981
Aug 11 2016 02:32
@jemagee Thanks, this challenge is too difficult for me.
CamperBot
@camperbot
Aug 11 2016 02:32
x981 sends brownie points to @jemagee :sparkles: :thumbsup: :sparkles:
:cookie: 298 | @jemagee |http://www.freecodecamp.com/jemagee
John
@raineyjt
Aug 11 2016 02:32
@jemagee I think you would write a code to find 5! or 12345 and then an if -then scenario that involves the multiple being either a real or nautural number
Stephen James
@sjames1958gm
Aug 11 2016 02:32
@cjpowellaz slice?
Chad Powell
@cjpowellaz
Aug 11 2016 02:33
sorry that was my first idea, Substring
decided to use substr to get to the first letter only
Stephen James
@sjames1958gm
Aug 11 2016 02:33
@edwardGunawan Maybe console.log e.target and see what you can do with that. It should be an html element that should allow access attributes such as href
@cjpowellaz concatenate the first letter to the rest of the string
@JordanShackelford :+1:
John Magee
@jemagee
Aug 11 2016 02:35
@x981 I've looked at it - but haven't gotten there yet - stuck on the smallest common multiple thing right now - the 'last part' i guess you could call it
Chad Powell
@cjpowellaz
Aug 11 2016 02:35
my test output is only returning the "I" from the first word instead of the first letter of each word after splitting it into an array
Stephen James
@sjames1958gm
Aug 11 2016 02:35
@x981 It means there are 101 pennies, so yes the total value of pennies in the drawer.
Jordan Shackelford
@JordanShackelford
Aug 11 2016 02:36
thanks @sjames1958gm
CamperBot
@camperbot
Aug 11 2016 02:36
jordanshackelford sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2496 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 11 2016 02:36
@raineyjt You got it?
Chad Powell
@cjpowellaz
Aug 11 2016 02:36
I should be getting an array ["I" "A" "L" "T" "P"]
John
@raineyjt
Aug 11 2016 02:36
@sjames1958gm yes. I just don't know how to write the code :)
Stephen James
@sjames1958gm
Aug 11 2016 02:37
@raineyjt You are really close, if you reset the challenge to get back the return change your line to a lower case F
John
@raineyjt
Aug 11 2016 02:37
@sjames1958gm thanks to you 2! I thought you were Camperbot in the chat earlier.
CamperBot
@camperbot
Aug 11 2016 02:37
raineyjt sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2497 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Zachary Taylor
@taylorz0917
Aug 11 2016 02:37

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line

  var search = Object.keys(source);
  for(var i = 0; i < search.length; i++){
    if(collection.hasOwnProperty(search[i])){
      var index = collection.getIndexOf(search[i]);
      arr = collection[index];
    }
    else {
      return collection.hasOwnProperty("Romeo");
    }
  }
  // Only change code above this line
  return arr;
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Hey guys! I am confused. Why does the hasOwnProperty() return false for "Romeo" and "first"? I am confused how key() & hasOwnProperty() are used in this challenge.
Stephen James
@sjames1958gm
Aug 11 2016 02:38
@taylorz0917 Collection is an array?
Zachary Taylor
@taylorz0917
Aug 11 2016 02:38
yes but of objects, no?
Stephen James
@sjames1958gm
Aug 11 2016 02:38
@taylorz0917 Yes, but you have to use hasOwnProperty on collection[i] not collection.
@cjpowellaz You return inside your loop which exits the function and you only process the first word.
Zachary Taylor
@taylorz0917
Aug 11 2016 02:39
Ahh, yes you had me answer my own question. You're good @sjames1958gm .
Thank you
Chad Powell
@cjpowellaz
Aug 11 2016 02:39
oh, ok
Stephen James
@sjames1958gm
Aug 11 2016 02:39
@taylorz0917 :) thanks
CamperBot
@camperbot
Aug 11 2016 02:39
sjames1958gm sends brownie points to @taylorz0917 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for taylorz0917
Stephen James
@sjames1958gm
Aug 11 2016 02:40
@cjpowellaz Does that make sense?
@taylorz0917 A suggestion. This challenge wants you to keep (filter) only certain elements in the collection array.
Have you used the .filter function on arrays?
@taylorz0917 inverting your two loops will also be benificial because you want to test every source on each collection entry
Chad Powell
@cjpowellaz
Aug 11 2016 02:42
it does yes, now to return the result outside of the function since my var caseChange is not global
Stephen James
@sjames1958gm
Aug 11 2016 02:43
@cjpowellaz You want to build up and array (or string) to return.
Chad Powell
@cjpowellaz
Aug 11 2016 02:44
right, concatenate should be the next step
Stephen James
@sjames1958gm
Aug 11 2016 02:45
@cjpowellaz This is a common pattern which you will use on several challenges, you initialize a variable before the loop.
Add to it in the loop.
Return it after the loop.
John
@raineyjt
Aug 11 2016 02:45
@sjames1958gm , How many brownie points do I have?
John Magee
@jemagee
Aug 11 2016 02:46
sigh - didn't work - still not getting through 8 properly
Chad Powell
@cjpowellaz
Aug 11 2016 02:46
ok
John
@raineyjt
Aug 11 2016 02:46
@camperbot how many brownie points do i have?
Stephen James
@sjames1958gm
Aug 11 2016 02:46
about @raineyjt
CamperBot
@camperbot
Aug 11 2016 02:46
:cookie: 146 | @raineyjt |http://www.freecodecamp.com/raineyjt
John
@raineyjt
Aug 11 2016 02:47
whats the issue? @jemagee
John Magee
@jemagee
Aug 11 2016 02:48
@raineyjt well when you find the smalles common multiple you use primes but when you get to a number like 8 you have to iterate through 2 more than once and i haven't figured it out yet is all - i will
Stephen James
@sjames1958gm
Aug 11 2016 02:49
@jemagee Are you using the GCD method?
John
@raineyjt
Aug 11 2016 02:50
not sure how you are measuring primes unless its with the remainder=0
Stephen James
@sjames1958gm
Aug 11 2016 02:50
@jemagee Prime factorization :clap:
John Magee
@jemagee
Aug 11 2016 02:50
@raineyjt if your'e still on the farenheit method you have a long way to go - you can build an array of primes pretty easily once you get the hang of it - it's an exercise
@sjames1958gm um - i'm not sure - let me see if i can pseudo code it for you (assuming you remember the exercise)
step 1 - sort the given array
Stephen James
@sjames1958gm
Aug 11 2016 02:52
@jemagee Smallest common multiple of a range. Yeah I brute forced that one. Tested multiples of max until all % return 0
John Magee
@jemagee
Aug 11 2016 02:54
Oh crap - i had it all spelled out and then hit escape - son of a gun
John
@raineyjt
Aug 11 2016 02:54
alt-f4 for the win @camperbot
Stephen James
@sjames1958gm
Aug 11 2016 02:56
@jemagee Sounds like a break is needed
John Magee
@jemagee
Aug 11 2016 02:57
Step 1 - Sort your given array
Step 2 - Create a newArray that is a range of (including them) the min and max given numbers
Step 3 - Create an array of primes up to (and including) the Max Number
Step 4 - create a result variable equal to 1
Step 5 - use Filter on newArray to remove all members of PRimeArray (yay indexOF) and multiple the result by said Prime
Step 6 - loop through the remaning elements of newArray - if the new result is divisible by the elment - AWESOME - but if not
Step 7 - loop through the primes and multiple by the result until the new result is divisible by the index number
Step 7 is where I'm stuck - numbers like 8 - you can't just multiple by 2 and move on - you gotta multiply by 2 probably twice
Physikeff
@Physikeff
Aug 11 2016 02:57
hi guys, is there a way to see the watch of the variables in FCC?
John Magee
@jemagee
Aug 11 2016 02:57
I have to iterate through 8 multiplying by 2 until the number is divisible by 8 - but my solution didn't work :(
Don't have a lot of time for breaks - i have limited time in a given day to get through these exercise and post work i gotta finish at least one
Physikeff
@Physikeff
Aug 11 2016 02:59
im in the Basic Algorithm Scripting
Stephen James
@sjames1958gm
Aug 11 2016 03:05
@jemagee What criteria do you remove the members of the prime array?
I see you are multiplying by all the primes in the range as they have to be factors of the answer.
John Magee
@jemagee
Aug 11 2016 03:06
@sjames1958gm I don't remove numbers from the prime array =- i remove numbers from the array in step 2 (the array with your range in it) IF they are members of the prime array - i also multiple by my result by said prime member - so all you have to do complicated testing on is the members of the range that aren't primes - i could post the code as it exists if anyone wants to see it
ignore the part at the bottom - the commented out part doesn't work yet

function smallestCommons(arr) {
  arr = arr.sort(function(a,b){
    return a-b;
  });

  var testArray = [];
  for (i=arr[0]; i<= arr[arr.length-1]; i++) {
    if (i !== 1) {
    testArray.push(i);
    }
  }
  var result = 1;
  var primes = [];
  for(i=2; i<= arr[arr.length-1]; i++) {
    var count = 0;
    if (i<4) {
      primes.push(i);
    } else {
      for(j=0; j<primes.length; j++) {
        if (i%primes[j] === 0) {
          count = 1;
          break;
        }
      } if (count === 0) {
        primes.push(i);
      }
    }
  }
  testArray = testArray.filter(function(a){
    if (primes.indexOf(a) === -1 ) {
      return true;
    } else {
      result *= a;
      return false;
    }
  });

  for(i=0; i<testArray.length; i++) {
    if (result%testArray[i] === 0) {
      break;
    /*} else {
      var x = testArray[i];
      for(j=0; j < primes.length; j++) {
        result *= primes[j];
        if (result%x === 0) {

        } else {
          return x;
        }
      }
    }
  }*/


  return result;
}


smallestCommons([1, 13]);
geecheechee
@geecheeche
Aug 11 2016 03:08
Hey gang, I have this string that I am supposed to split by its spaces. It is
var string = "Split me into an array";
var array = []; and the solution that I have is array = string.split[" "];
Stephen James
@sjames1958gm
Aug 11 2016 03:09
@geecheeche use () not [] for calling a function.
John Magee
@jemagee
Aug 11 2016 03:09
@geecheeche double check the MDN on split and see if [] is the right way to do things
this code works on 1-5
geecheechee
@geecheeche
Aug 11 2016 03:11
@sjames1958gm cheers lad. Thanks.
CamperBot
@camperbot
Aug 11 2016 03:11
geecheeche sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2498 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
John Magee
@jemagee
Aug 11 2016 03:11
but when you have numbers like 8, or say 18 - that have the same prime MULTIPLE times it doesn't work as well :(
geecheechee
@geecheeche
Aug 11 2016 03:11
@jemagee cheers mate. Thanks.
CamperBot
@camperbot
Aug 11 2016 03:11
geecheeche sends brownie points to @jemagee :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @jemagee |http://www.freecodecamp.com/jemagee
Stephen James
@sjames1958gm
Aug 11 2016 03:11
@jemagee yeah
John Magee
@jemagee
Aug 11 2016 03:11
@geecheeche no problem - i try to avoid giving the answer right away :)
@sjames1958gm I've tried creating a local variable out ot he i variable - using a complex while statement to do 'multiple' result *= prime[j]; but it didn't work
Stephen James
@sjames1958gm
Aug 11 2016 03:12
Maybe a different algorithm. You are basically needing prime factorization and Wikipedia says that is difficult.
geecheechee
@geecheeche
Aug 11 2016 03:12
@jemagee You are right. No spoon-feeding please, but you are a sport mate. I totally am grateful for your existence. Bless.
Reyner
@ReynerAL
Aug 11 2016 03:13

guys I have a question regarding the switch statements...

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1 :
return "alpha";
break;
case 2 :
return "beta";
break;
case 3 :
return "gamma";
break;
case 4 :
return "delta";
}
// Only change code above this line
return answer;
}

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

the assignment wants me to put break in there, but isn't it fine to remove the break if I code like this??

John Magee
@jemagee
Aug 11 2016 03:13
@sjames1958gm i don't mind difficult - i just hate when my mind can't get the logic right :)
Stephen James
@sjames1958gm
Aug 11 2016 03:13
@jemagee I mean difficult in a mathematics sense. since there is no known general efficient algorithm for integer factorization
John Magee
@jemagee
Aug 11 2016 03:13
I mean - i guess I should be glad it's taking me longer - i mean - i've only been at it 10 days and i'm up to this point - though i skipped a few repetitive 'projects'
then how the frack am i supposed to solve it - brute force just seems - um - inelegant
Stephen James
@sjames1958gm
Aug 11 2016 03:14
Maybe try the GCD method.
John Magee
@jemagee
Aug 11 2016 03:14
can you point me to a link on GCD method - cause i have a feeling i'm going to have to start over - though i'm going to try something bruteforcey and see what happens :)
Stephen James
@sjames1958gm
Aug 11 2016 03:14
There are fast algorithms for computing the GCD that do not require the numbers to be factored, such as the Euclidean algorithm
John Magee
@jemagee
Aug 11 2016 03:19
except their example doesn't make any sense to me - how does lcm(21,6) go to lcm(3,5)
6 that is
John Magee
@jemagee
Aug 11 2016 03:26
I don't even know that the wikipedia page means - so that's not much help
Subramanya Chakravarthy
@chakrihacker
Aug 11 2016 03:30
@ReynerAL return exits the switch
so either remove return or break
since fcc asked to use break
save d answer as sommthing like answer = "alpha";
and return answer at the end
I mean out of the switch statement
Reyner
@ReynerAL
Aug 11 2016 03:34
@chakrihacker I see.. thank you for your help!
CamperBot
@camperbot
Aug 11 2016 03:34
reyneral sends brownie points to @chakrihacker :sparkles: :thumbsup: :sparkles:
:cookie: 287 | @chakrihacker |http://www.freecodecamp.com/chakrihacker
Suprith Aireddy
@sup-rith
Aug 11 2016 03:40
does anyone know php that can help me?
Vlad Fernandes
@Vlad-Fernandes
Aug 11 2016 03:43
@sup-rith what is your issue?
Xiao Yang
@xiaopow
Aug 11 2016 03:44
If you need JavaScript help, post them on www.codeforx.com and we will reply asap. Don't forget to add the labels FreeCodeCamp and JavaScript so other campers can find them.
Suprith Aireddy
@sup-rith
Aug 11 2016 03:44
@vieira83 I want to redirect a page based on the time of day
Vlad Fernandes
@Vlad-Fernandes
Aug 11 2016 03:45
@sup-rith header("Location: http://example.com/myOtherPage.php");
Suprith Aireddy
@sup-rith
Aug 11 2016 03:46

` <?php
date_default_timezone_set('America/Chicago');

// $time = $_SERVER['REQUEST_TIME'];
$time = 1470463270;

$hour = date('H', $time);
$min = date('i', $time);

echo $hour.":".$min."<br>";

$today = date("D", $time);
echo $today."<br>";

if($today == "Mon"){ /11am - 2PM 5:30PM-9:30PM/
if( $hour == 3 )
} else if($today == "Tue"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Wed"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Thu"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Fri"){ /11am - 2:30PM 5:30PM-10:30PM/

} else if($today == "Sat"){ // 11:30am - 2:30pm 5:30pm-10:30pm

} else if($today == "Sun"){ // 11:30am - 2:30pm 5:30pm-9:30pm

}

?>
`\

`` <?php
date_default_timezone_set('America/Chicago');

// $time = $_SERVER['REQUEST_TIME'];
$time = 1470463270;

$hour = date('H', $time);
$min = date('i', $time);

echo $hour.":".$min."<br>";

$today = date("D", $time);
echo $today."<br>";

if($today == "Mon"){ /11am - 2PM 5:30PM-9:30PM/
if( $hour == 3 )
} else if($today == "Tue"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Wed"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Thu"){ /11am - 2PM 5:30PM-9:30PM/

} else if($today == "Fri"){ /11am - 2:30PM 5:30PM-10:30PM/

} else if($today == "Sat"){ // 11:30am - 2:30pm 5:30pm-10:30pm

} else if($today == "Sun"){ // 11:30am - 2:30pm 5:30pm-9:30pm

}

?> ``

Vlad Fernandes
@Vlad-Fernandes
Aug 11 2016 03:46
set the Location to the url you want to redirect
Suprith Aireddy
@sup-rith
Aug 11 2016 03:46
if the time is between 11am - 2PM & 5:30PM-9:30PM
then I want to redirect
Vlad Fernandes
@Vlad-Fernandes
Aug 11 2016 03:47
or another aproach is use javascript
echo '<script type="text/javascript">
window.location = "http://www.google.com/"
</script>';
CamperBot
@camperbot
Aug 11 2016 03:47
@vieira83 said: echo '<script type="text/javascript">
window.location = "http://www.google.com/"
</script>';
Suprith Aireddy
@sup-rith
Aug 11 2016 03:47
how do I use time tho?
like if its 10:59 am i want it to redirect
John Magee
@jemagee
Aug 11 2016 03:52
sigh - just can't get the last one to pass
Suprith Aireddy
@sup-rith
Aug 11 2016 03:52
@vieira83 do you know how?
Vlad Fernandes
@Vlad-Fernandes
Aug 11 2016 03:56
know what?
ZZPot
@ZZPot
Aug 11 2016 03:57
Where I can read about how twitch works?
Jaren Escueta
@jarenescueta731
Aug 11 2016 03:57
@jemagee did you post your code up there somewhere? i can't find it -.-
John Magee
@jemagee
Aug 11 2016 03:57
a while ago - but it's changed now :)
ZZPot
@ZZPot
Aug 11 2016 03:57
I mean, I never used it before and I won't, but I should pass the challenge and I didn't get how it works
FM
@mafelix
Aug 11 2016 03:59
@nguyen-huu-duc it's not a cross origin error anymore
@nguyen-huu-duc you have other errors to deal with now. so it's a step in the right direction
Jaren Escueta
@jarenescueta731
Aug 11 2016 03:59
those are the docs for their api
@jemagee i'd like to see if i can help
John Magee
@jemagee
Aug 11 2016 04:01
good luck - i've been told the way that i'm doing it is impossible - but it's tricking me since everything works except the last test - and i am at a loss
Cole Logan
@CocaWinkle
Aug 11 2016 04:01
I need help with bootstrap
John Magee
@jemagee
Aug 11 2016 04:01

function smallestCommons(arr) {
  arr = arr.sort(function(a,b){
    return a-b;
  });

  var testArray = [];
  for (i=arr[0]; i<= arr[arr.length-1]; i++) {
    if (i !== 1) {
    testArray.push(i);
    }
  }
  var result = 1;
  var primes = [];
  for(i=2; i<= arr[arr.length-1]; i++) {
    var count = 0;
    if (i<4) {
      primes.push(i);
    } else {
      for(j=0; j<primes.length; j++) {
        if (i%primes[j] === 0) {
          count = 1;
          break;
        }
      } if (count === 0) {
        primes.push(i);
      }
    }
  }
  testArray = testArray.filter(function(a){
    if (primes.indexOf(a) === -1 ) {
      return true;
    } else {
      result *= a;
      return false;
    }
  });
  for(i=0; i<testArray.length; i++) {
    if (result%testArray[i] === 0) {
      continue;
    } else {
      var x = testArray[i];
      for (j=0; j<= primes.length; j++) {
        if (testArray[i]%primes[j] !== 0) {
          continue;
        } else {
          while( x !== primes[j] && result%testArray[i] !== 0 && x % primes[j] === 0) {
            result *= primes[j];
            if (x % primes[j] === 0) {
              x /= primes[j]; }
            else {
              x = primes[j];
            }
          }
        }
      }
    }
  }
  return result;
}


smallestCommons([23, 18]);
ZZPot
@ZZPot
Aug 11 2016 04:01
@jarenescueta731 as I understand, there are 3 types of entity: users, channels and streams. right?
Cole Logan
@CocaWinkle
Aug 11 2016 04:01
angularUI.PNG
how do I make those color boxes on the right?
Sabrina Ferguson
@itsacoyote
Aug 11 2016 04:02
@CocaWinkle to match the colors?
Cole Logan
@CocaWinkle
Aug 11 2016 04:03
no I know how to make the color
@itsacoyote
ZZPot
@ZZPot
Aug 11 2016 04:03
@CocaWinkle float: right?
Jaren Escueta
@jarenescueta731
Aug 11 2016 04:03
@ZZPot for the project i only had to use channels
Sabrina Ferguson
@itsacoyote
Aug 11 2016 04:03
@CocaWinkle are you using bootstrap
Cole Logan
@CocaWinkle
Aug 11 2016 04:03
@itsacoyote @itsacoyote @itsacoyote yes
Sabrina Ferguson
@itsacoyote
Aug 11 2016 04:03
Cole Logan
@CocaWinkle
Aug 11 2016 04:03
@ZZPot thanks I need that for the placement
CamperBot
@camperbot
Aug 11 2016 04:04
cocawinkle sends brownie points to @zzpot :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @zzpot |http://www.freecodecamp.com/zzpot
Sabrina Ferguson
@itsacoyote
Aug 11 2016 04:04
contextual colors or contextual backgrounds are probably what you want
Jessuir Cleydson
@jessuircleydson
Aug 11 2016 04:04
@CocaWinkle display:inline-block
Sabrina Ferguson
@itsacoyote
Aug 11 2016 04:05
Cole Logan
@CocaWinkle
Aug 11 2016 04:06
@jessuircleydson @itsacoyote thanks! I'll come back if I need more help
CamperBot
@camperbot
Aug 11 2016 04:06
:cookie: 12 | @jessuircleydson |http://www.freecodecamp.com/jessuircleydson
:cookie: 348 | @itsacoyote |http://www.freecodecamp.com/itsacoyote
cocawinkle sends brownie points to @jessuircleydson and @itsacoyote :sparkles: :thumbsup: :sparkles:
comaeternal
@comaeternal
Aug 11 2016 04:07
This message was deleted
// Declare your variable here
var myGlobal = 10;

function fun1() {
  // Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
ZZPot
@ZZPot
Aug 11 2016 04:08
question about twitch: can one channel has more than one stream?
can one user has more than one channel?
comaeternal
@comaeternal
Aug 11 2016 04:09
I dont understand what this means... "Inside function fun1, assign 5 to oopsGlobal without using the var keyword."
or how to do solve this
ZZPot
@ZZPot
Aug 11 2016 04:09
@comaeternal declare new variable called "oopsGlobal "
Surbhi Oberoi
@surbhioberoi
Aug 11 2016 04:09
http://codepen.io/surbhioberoi/pen/kXzrLP
i need someone to help debug this
Jaren Escueta
@jarenescueta731
Aug 11 2016 04:10
@jemagee this might take me a while... gonna tackle this problem after refueling this vessel
comaeternal
@comaeternal
Aug 11 2016 04:10
using consol.log?
ZZPot
@ZZPot
Aug 11 2016 04:10
@comaeternal hell no, dude!
John Magee
@jemagee
Aug 11 2016 04:10
@jarenescueta731 hey - its ok - according to wikipedia i'm doing it the hard way - obviously there's an issue with the fact that i'm starting at 18 and not 1 :)
ZZPot
@ZZPot
Aug 11 2016 04:10
@comaeternal right under first declaration (var myGlobal )
Jaren Escueta
@jarenescueta731
Aug 11 2016 04:11
@jemagee phew... ok good luck!
ZZPot
@ZZPot
Aug 11 2016 04:11
can one channel has more than one stream?
can one user has more than one channel?
comaeternal
@comaeternal
Aug 11 2016 04:12
@ZZPot but the instructions say not to use var.
Jessuir Cleydson
@jessuircleydson
Aug 11 2016 04:13
You assign the variable myGlobal with 10, then he tell you to assign the variable oopsGlobal with 5
@comaeternal
ZZPot
@ZZPot
Aug 11 2016 04:13
@comaeternal give me link to challenge
Jessuir Cleydson
@jessuircleydson
Aug 11 2016 04:15
@comaeternal sorry, I see the instructions now haha
Troy
@twf
Aug 11 2016 04:17
@comaeternal var oopsGlobal = 5;
ZZPot
@ZZPot
Aug 11 2016 04:18
you can assign value to variables without declaring variables and it's will be it's declaration
kinda wierd
ofcourse it will declare them in the global namespace
comaeternal
@comaeternal
Aug 11 2016 04:20
so how does this look like?
Vikrant Singh
@VikrantSingh13
Aug 11 2016 04:21
??
Abis Mal
@abisthecodermal
Aug 11 2016 04:22
nailed it. Yeah!!!
Surbhi Oberoi
@surbhioberoi
Aug 11 2016 04:22
can someone please help me debug something that was working fine a while back?
Abis Mal
@abisthecodermal
Aug 11 2016 04:22
Roman Numeral Converter in. The. Bag
sure
I can do anything right now!!
the buttons were working fine
something i messesd up
in css
can't figure out now
Abis Mal
@abisthecodermal
Aug 11 2016 04:24
try hitting Ctrl+Z
:laughing:
Surbhi Oberoi
@surbhioberoi
Aug 11 2016 04:24
codepen
it doesn't work if at some point i closed my tab, which i did
Abis Mal
@abisthecodermal
Aug 11 2016 04:24
yeah it works
oh...damn
ok.
Surbhi Oberoi
@surbhioberoi
Aug 11 2016 04:25
i don't know what is wrong, please help
Abis Mal
@abisthecodermal
Aug 11 2016 04:25
This is advanced for me. I am a basic guy
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:25
I am a "double quoted" string inside "double quotes".
Abis Mal
@abisthecodermal
Aug 11 2016 04:26
type about @abisthecodermal and check
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:26
it showing error in my code
plz help
I have to print this sentence
Abis Mal
@abisthecodermal
Aug 11 2016 04:26
what is the error? @deepika-gupta
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:27
var myStr= "I am a \" double quoted\" string inside\" double quotes\"." ;
I have written this code
is there any mistake
errror is : Variable myStr should contain the string: I am a "double quoted" string inside "double quotes".
Abis Mal
@abisthecodermal
Aug 11 2016 04:28
double quotes and single quotes. Use them wisely to get the results :)
@deepika-gupta
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:29
:(
Jay Song
@gnosyaj
Aug 11 2016 04:30

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
var celcius;
fahrenheit = celcius * 9/5 + 32;
// Only change code above this line
return fahrenheit;
}

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

what's wrong here?
tryiong to convert to Fahrenheit
Abis Mal
@abisthecodermal
Aug 11 2016 04:31
'I said: "use them wisely", but I was confusing'
@deepika-gupta
fahrenheit = celcius * 9/5 + 32;
celcius???
@gnosyaj
Jay Song
@gnosyaj
Aug 11 2016 04:31
?
Abis Mal
@abisthecodermal
Aug 11 2016 04:32
function convertToF(celsius) {
@gnosyaj
pahosler
@pahosler
Aug 11 2016 04:32
any nodejs gurus in here? need some assistance if you are, I've got deadly silence in the nodejs/node room....
Abis Mal
@abisthecodermal
Aug 11 2016 04:33
sorry. Haven't gotten to that point yet
@pahosler
Jay Song
@gnosyaj
Aug 11 2016 04:33
You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit.
anyone?
Abis Mal
@abisthecodermal
Aug 11 2016 04:34
function convertToF(celsius) {

You get celsius you write

fahrenheit = celcius * 9/5 + 32;

celcius
@gnosyaj

there's a typo
Jay Song
@gnosyaj
Aug 11 2016 04:34
oh....
gosh...
effing a
my goodnes...
Abis Mal
@abisthecodermal
Aug 11 2016 04:35
I know
Jay Song
@gnosyaj
Aug 11 2016 04:35
LOL thank you so much
Abis Mal
@abisthecodermal
Aug 11 2016 04:35
:)
happened to me yesterday.
Jay Song
@gnosyaj
Aug 11 2016 04:35
freakign stuck on that for like 10 minutes staring at the pc
like wtf
Abis Mal
@abisthecodermal
Aug 11 2016 04:36
:laughing:
tyl-er
@tyl-er
Aug 11 2016 04:36

Having trouble with Counting Cards

I'm sure there's a simpler way to do this, but I had no idea what you're supposed to do so I just tried to be creative.

instructions:
Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"
Cards Sequence 7, 8, 9 should return "0 Hold"
Cards Sequence 10, J, Q, K, A should return "-5 Hold"
Cards Sequence 3, 7, Q, 8, A should return "-1 Hold"
Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"
Cards Sequence 2, 2, 10 should return "1 Bet"
Cards Sequence 3, 2, A, 10, K should return "-1 Hold"

var count = 0;

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

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

if (count > 0) {
console.log(count + "Bet");
} else if (count === 0) {
console.log("0 Hold");
} else {
console.log(count + "Hold");
}

so my function returns 1 instead of 0. Also the if statement doesn't print to the console at all.

Abis Mal
@abisthecodermal
Aug 11 2016 04:36
@deepika-gupta , were you able to rectify the problem??
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:37
na
not getting
pahosler
@pahosler
Aug 11 2016 04:37
did you report the typo you discovered? Please do in the forum or github issues so they can fix it, probably a typo from the recent update
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:37
@abisthecodermal
Abis Mal
@abisthecodermal
Aug 11 2016 04:38
yes?
Deepika Gupta
@deepika-gupta
Aug 11 2016 04:38
not getting
the solution
tried many times
Abis Mal
@abisthecodermal
Aug 11 2016 04:39
case 9:
return count;
break;
case 10:
@tyl-er
when you return something. It snaps out of the function. Further instructions are not executed
It exists this code altogether
so check for returns
@tyl-er. was I clear enough?
paste your code again. @deepika-gupta
Cole Logan
@CocaWinkle
Aug 11 2016 04:43
bootstrapstackinghelp.PNG
how do I stack the buttons and the p elements on top of eachother
they dont look good at all
Oleg
@designofhumanity
Aug 11 2016 04:45

function actuallyIamMethodOfWindow () {
console.log("You are invoke method of window object")
}
window.actuallyIamMethodOfWindow();
VM583:2 You are invoke method of window object

window.newFunction = function () {
console.log("new function glued to window and become actually method");
}
newFunction();
new function glued to window and become actually method
//conclusution there is no function only there is a methods in javascripts?

tyl-er
@tyl-er
Aug 11 2016 04:47
@abisthecodermal I think so. So count = 0. It runs case 2 and and case 3 then stops. So it returns Count + 1. Which eaquals 1. Is that right?
Abis Mal
@abisthecodermal
Aug 11 2016 04:47
return statement exits the function
that is why you never get to if
remove return from case statements
silver537
@silver537
Aug 11 2016 04:48
@oleg what are you trying to do?
Rico042002
@rico042002
Aug 11 2016 04:49
anybody know how I could change this If/else statement to a proper switch statement
tyl-er
@tyl-er
Aug 11 2016 04:49
@abisthecodermal Got it. Let me try to fix it.
Abis Mal
@abisthecodermal
Aug 11 2016 04:49
great!
Rico042002
@rico042002
Aug 11 2016 04:50
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

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

// Test your code by modifying these values
checkObj("gift");
Abis Mal
@abisthecodermal
Aug 11 2016 04:50
brb. Someone needs a Hansel and Gretel Story before going to bed.
Oleg
@designofhumanity
Aug 11 2016 04:51
This message was deleted
Rico042002
@rico042002
Aug 11 2016 04:51
nobody
??
silver537
@silver537
Aug 11 2016 04:53
@rico042002 switch (myObj.hasOwnProperty (checkProp)){ case true: return myObj [checkProp]; break; default: return "Not Found";}
pahosler
@pahosler
Aug 11 2016 04:54
@rico042002 yeah, your comment at the top only has one slash....
Abis Mal
@abisthecodermal
Aug 11 2016 04:54
some thing like
Switch (checkProp){
case "gift": return "pony"
@rico042002
pahosler
@pahosler
Aug 11 2016 04:54
otherwise it worked as is for me
Abis Mal
@abisthecodermal
Aug 11 2016 04:55
which comment @pahosler
you had /Setup should be // Setup
Abis Mal
@abisthecodermal
Aug 11 2016 04:56

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

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

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

no, it had two slashes...
@pahosler
scroll up and check
pahosler
@pahosler
Aug 11 2016 04:57
it worked for me anyway, unless you were having an issue you didn't describe???
oic you were wanting to convert to switch/case LOL
why????
maybe you want a ternary instead???
return (myObj.hasOwnPorperty(checkProp)) ? myObj[checkProp] : "Not Found"
silver537
@silver537
Aug 11 2016 05:01
@rico042002 are you even payin attention? 0.o
tyl-er
@tyl-er
Aug 11 2016 05:01

@abisthecodermal Ok so the math works, but nothing prints to the console.

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++;
break;
case 7:
case 8:
case 9:
count + 0;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
break;
}
// Only change code above this line
}

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

/if (count > 0) {
console.log(count + "Bet");
} else if (count === 0) {
console.log("0 Hold");
} else {
console.log(count + "Hold");
}
/

pahosler
@pahosler
Aug 11 2016 05:02
help format
CamperBot
@camperbot
Aug 11 2016 05:02

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Rico042002
@rico042002
Aug 11 2016 05:03
@tyl-er change your console.logs to return statements
silver537
@silver537
Aug 11 2016 05:04
@tyl-er you would have to view the browsers console. If ya usin windows, ctr+shift+c
If ya wanna pass the test, ya gotta use returns instead.
tyl-er
@tyl-er
Aug 11 2016 05:08

@rico042002
if (count > 0) {
return (count + "Bet");
} else if (count === 0) {
return ("0 Hold");
} else {
return (count + "Hold");
}

getting this error
SyntaxError: Illegal return statement

oh wait a minute
Still getting the same error
Rico042002
@rico042002
Aug 11 2016 05:09
  if (count > 0){
    return count + " Bet";
  } else {
    return count + " Hold";
  }
silver537
@silver537
Aug 11 2016 05:11
damn.. its dead.
pahosler
@pahosler
Aug 11 2016 05:13
time for Blade Runner...
tyl-er
@tyl-er
Aug 11 2016 05:15

@rico042002 so i commented out everything but this:
var count = 0;

if (count > 0){
return count + " Bet";
} else {
return count + " Hold";
}
Still getting that error

kalana
@kalana1985
Aug 11 2016 05:17
please help with 'Increment a Number with JavaScript
'
tried every possible combinations but can't get through
silver537
@silver537
Aug 11 2016 05:19
variable++
thats how you incriment
or variable+=1
kalana
@kalana1985
Aug 11 2016 05:19
its not working tho
silver537
@silver537
Aug 11 2016 05:19
or variable = variable + 1
show your code
kalana
@kalana1985
Aug 11 2016 05:20
88 =87++;
myVar should equal 88
myVar = myVar should be changed
Use the ++ operator
Do not change code above the line
silver537
@silver537
Aug 11 2016 05:21
it doesn't work that way. the = is an assignment operator.
you use the variable they defined for you. and increment that one.
kalana
@kalana1985
Aug 11 2016 05:23

var myVar = 87;

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

thats the variable
silver537
@silver537
Aug 11 2016 05:25
it should work.
tyl-er
@tyl-er
Aug 11 2016 05:25
@rico042002 no worries I figured it out. Was trying to use return outside a function.
silver537
@silver537
Aug 11 2016 05:26
@kalana1985 Change the code to use the ++ operator on myVar
kalana
@kalana1985
Aug 11 2016 05:29
i just typed 87++;
silver537
@silver537
Aug 11 2016 05:30
noooooo
kalana
@kalana1985
Aug 11 2016 05:30
it's not working tho
silver537
@silver537
Aug 11 2016 05:30
you shouldn't use numbers at all

variable++

what variable did they give you?

put ++ after it.
kalana
@kalana1985
Aug 11 2016 05:31
i see
gotcha
thanks a lot, its so easy but my dumb brain didn't process it
lol
John Magee
@jemagee
Aug 11 2016 05:46
so - i'm about to quit code camp because of the smallest common multiple exercise because there's no useful guidance anywhere for those of us who get stuck in the LCD loop
Vercaelus
@Vercaelus
Aug 11 2016 05:46
Does anyone know of a way to dynamically change a <div> to be the same height as a responsive <img>?
@jemagee You can check here, if youre stuck https://github.com/freecodecamp/freecodecamp/wiki
John Magee
@jemagee
Aug 11 2016 05:47
i'm not stuck so much as the help i've looked for has been useless
i got pointed to a wikipedia page that was useless
the link they provided is useless
Vercaelus
@Vercaelus
Aug 11 2016 05:48
John Magee
@jemagee
Aug 11 2016 05:49
@Vercaelus getting the answer isn't the same as ggetting some guidance - also - it's a ridiculous ass exercise if one of the optoins people are going to try is an algorithm THAT NO ONE HAS SUCCESFULLY EVER WRITTEN but is the basic smart math solution to the exercise
pahosler
@pahosler
Aug 11 2016 05:52
succesfully written algorithum for smallest common multiple...
/*
 * Find the smallest common multiple of the provided parameters that can be
 * evenly divided by both, as well as by all sequential numbers in the range
 * between *these parameters.
 *
 * The range will be an array of two numbers that will not necessarily be in
 * numerical order.
 *
 * e.g. for 1 and 3 - find the smallest common multiple of both 1 and 3 that is
 * evenly divisible by all numbers between 1 and 3.
 */

function smallestCommons(arr) {
    var dArr = []; //delta array
    // sort array in numerical order
    arr.sort(function(a, b) {
        return a - b;
    });
    for (var i = arr[0]; i < arr[arr.length - 1]; i++) {
        if (i + 1 < arr[arr.length - 1]) arr.splice(-1, 0, i + 1);
    }
    dArr = arr.slice(0); // copy arr to delta to maintain change in arr

    function getSmallest() {

        arr.forEach(function(e, i, a) {
            e < a[a.length - 1] ? a[i] = e += dArr[i] : e = e;
            a[a.length - 1] < e ? a[a.length - 1] += dArr[dArr.length - 1] : a[a.length - 1] = a[a.length - 1];
            this.stack = a[0]; // I'll just leave this here for now, get it with stack outside of here...
        }, this);
    }
    while (arr[0] !== arr[arr.length - 1]) {
        getSmallest();
    }

    //like this console.log(stack); it should work anyway...
console.log("stack ",stack);
    return arr[0];
}

//console.log(smallestCommons([1, 5])); // should return 60
//console.log(smallestCommons([5,1])); // should return 60
//console.log(smallestCommons([1,13])); // should return 360360
console.log(smallestCommons([23,18])); // should return 6056820
Vercaelus
@Vercaelus
Aug 11 2016 05:52
@jemagee You're right, giving the answer isn't the same as holding your hand and walking you through step-by-step. However, unless you pay for a tutor, you'll unlikely ever have that. Part of programming is being able to figure things out for yourself. If you cant get guidance, then the answer is the next best thing. Try to walk yourself through it, and see why things are working the way they are.
pahosler
@pahosler
Aug 11 2016 05:53
I worked my arse off to get that to work, no help...
John Magee
@jemagee
Aug 11 2016 05:53
@Vercaelus I'm not looking for step by step - i've gotten most of it to work except 18...23 which is a mo fo - it would have been nice if there was a little hint not to waste 6 hours on an algorithm no one ever solved - but hey - you're right - it's free so it shouldn't be quality
pahosler
@pahosler
Aug 11 2016 05:53
it pays to experiment
John Magee
@jemagee
Aug 11 2016 05:53
the whole open source community just died
@pahosler did you do prime facotiral or there backwards answer?

function smallestCommons(arr) {
  arr = arr.sort(function(a,b){
    return a-b;
  });

  var testArray = [];
  for (i=arr[0]; i<= arr[arr.length-1]; i++) {
    if (i !== 1) {
    testArray.push(i);
    }
  }
  var result = 1;
  var primes = [];
  for(i=2; i<= arr[arr.length-1]; i++) {
    var count = 0;
    if (i<4) {
      primes.push(i);
    } else {
      for(j=0; j<primes.length; j++) {
        if (i%primes[j] === 0) {
          count = 1;
          break;
        }
      } if (count === 0) {
        primes.push(i);
      }
    }
  }
  testArray = testArray.filter(function(a){
    if (primes.indexOf(a) === -1 ) {
      return true;
    } else {
      result *= a;
      return false;
    }
  });

  testArray = testArray.filter(function(a){
    if(result%a === 0) {
      return false;
    } else {
        return true;
      }
  });
  for (i=0; i< testArray.length; i++) {
    var w = 0;
    var v = testArray[i];
    var u = 0;

    while(result%testArray[i] !== 0) {
      if (v%primes[w] === 0) {
        result *= primes[w];
        v /= primes[w];
        if (result%(primes[w]*primes[w]) === 0 && testArray[i]%(primes[w]*primes[w]) === 0) {v /= primes[w];}
      } else {
        w += 1;
      }
    }
    if (testArray[i] === 21) {return result;}  
  }
  return result;
}


smallestCommons([18, 23]);
don't ever try to do it the mathematically correct way folks - can't be done
that's what bothers me - the correct mathematical way to do it isn't the answer
silver537
@silver537
Aug 11 2016 05:54
You can do a prime factorial to check for greatest divider
Omg... your code is dirty!!!
Mathematical way is always the answer.
For any mathematical problems in programming.
Gerren Jackson
@gerrenjj
Aug 11 2016 05:57
hi everyone
John Magee
@jemagee
Aug 11 2016 05:58
@silver537 except for 18 - 23 how do you get the 2 and 3 here
@silver537 I'm terribly sorry my code offends your delicate senses - it's probably the dirtiest code ever seen in a free code camp - everything after the two filters is experiments
pahosler
@pahosler
Aug 11 2016 06:00
way out of practice with math, if a solution works it's a good solution, if there is a better way then use it, the built in funtions are not always faster or better than itterating over an array. For example you can calculate the points to plot a circle, put those point in an array, and you cna draw any size circle any number of times way faster than doing the math over and over... just a simple example of course
Gerren Jackson
@gerrenjj
Aug 11 2016 06:00
function isLess(a, b) {
  // Fix this code
  if (a < b) {
    return true;
  } else {
    return false;
  }
}

// Change these values to test
isLess(10, 15);
anyone know how to do this one
silver537
@silver537
Aug 11 2016 06:01
I'll show you my code when i get cleaned up
John Magee
@jemagee
Aug 11 2016 06:01
@silver537 no thanks - not interested in snobs
CamperBot
@camperbot
Aug 11 2016 06:01
jemagee sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 475 | @silver537 |http://www.freecodecamp.com/silver537
John Magee
@jemagee
Aug 11 2016 06:01
@gerrenjj what's wrong with the code? Which test fails
Gerren Jackson
@gerrenjj
Aug 11 2016 06:01
says i cant use if/else statements
Returning Boolean Values from Functions
John Magee
@jemagee
Aug 11 2016 06:02
@gerrenjj link?
ahkay
@ahkay
Aug 11 2016 06:05

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

return collection;

}

Any ideas on this one?
Piotr Francug
@pfrancug
Aug 11 2016 06:06
Instructions
Fix the function isLess to remove the if/else statements.
John Magee
@jemagee
Aug 11 2016 06:06
@gerrenjj if you look at the example you'll see that when you return a boolean you can just 'return' on the evaluation
return a === b returns true is a and b are 5, but false if a is 5 and b is 4
Gerren Jackson
@gerrenjj
Aug 11 2016 06:07
@pfrancug @jemagee ok thank you
CamperBot
@camperbot
Aug 11 2016 06:07
gerrenjj sends brownie points to @pfrancug and @jemagee :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @jemagee |http://www.freecodecamp.com/jemagee
:cookie: 8 | @pfrancug |http://www.freecodecamp.com/pfrancug
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:08
@jemagee the lcm challenge was tough, i ended up using euclid's algo.
http://www.wikihow.com/Find-the-Least-Common-Multiple-of-Two-Numbers
uses recursion a little bit. just another approach if you haven't seen it already :)
John Magee
@jemagee
Aug 11 2016 06:08
@jarenescueta731 someone pointed that to me earlier - via wikipedia - which was no help :) I'll see if this works better
Markus Kiili
@Masd925
Aug 11 2016 06:12
@jemagee You always have the option to just generate multiples of the larger number and check if it is evenly dividable by all the numbers in the range. Very simple (and slow) algorithm, but easy to make the code.
John Magee
@jemagee
Aug 11 2016 06:13
@Masd925 yes - i could write the function purely to solve the qustions given - but i try to avoid that
pahosler
@pahosler
Aug 11 2016 06:13
@gerrenjj take the info they have given you return a===b and try different comparisons, experiment and play around with the code
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:14
@ahkay your first else if could look better, and not entirely sure it's correct
Gerren Jackson
@gerrenjj
Aug 11 2016 06:14
@pahosler i fixed it. thank you though
CamperBot
@camperbot
Aug 11 2016 06:14
gerrenjj sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 338 | @pahosler |http://www.freecodecamp.com/pahosler
pahosler
@pahosler
Aug 11 2016 06:14
remember you have things like >= or != or etc...
okay cool!
cherry-geqi
@cherry-geqi
Aug 11 2016 06:15
pahosler
@pahosler
Aug 11 2016 06:15
they changed a lot of these sense I did them :O
cherry-geqi
@cherry-geqi
Aug 11 2016 06:15
Shouldn't the 4th test be 4?
14:15
Hello, in challenge: www.freecodecamp.com/challenges/pairwise
Shouldn't the 4th test be 4?
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:15
@ahkay you want to make sure, if value is empty and props is not equal to "tracks", assign the value
pahosler
@pahosler
Aug 11 2016 06:17
@cherry-geqi been avoiding that one, haven't done it yet... might get around to it this weekend
but no, it should be 10
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:18
@cherry-geqi you want to add the indices of the numbers
cherry-geqi
@cherry-geqi
Aug 11 2016 06:18
Of cource, I have passed the other 3 tests.
ahkay
@ahkay
Aug 11 2016 06:18
@jarenescueta731 you mean the "!" in the conditions? I was trying to reverse the boolean of "hasOwnProperty" - it seems to output the right results in the console, but the tests are saying that the second else if isn't working... Not sure if I'm making myself clear!
cherry-geqi
@cherry-geqi
Aug 11 2016 06:18
the other 4
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:19
@cherry-geqi i ran into the same problem, the 4th test indices would end up being 0, 1, 4, 5
so 10
Markus Kiili
@Masd925
Aug 11 2016 06:19
@cherry-geqi Pairs have indices 0+4, 1+5
John Magee
@jemagee
Aug 11 2016 06:19
@jarenescueta731 sadly i still can't see how this works for the 18-23 solution
ahkay
@ahkay
Aug 11 2016 06:21
@jarenescueta731 Thanks, the correct result is showing up in the console - ie doing what you've said there when I put in those parameters.
CamperBot
@camperbot
Aug 11 2016 06:21
ahkay sends brownie points to @jarenescueta731 :sparkles: :thumbsup: :sparkles:
:cookie: 352 | @jarenescueta731 |http://www.freecodecamp.com/jarenescueta731
lazy_bunny
@lazyCoder036
Aug 11 2016 06:23
help needed for problem #247
CamperBot
@camperbot
Aug 11 2016 06:23
no wiki entry for: needed for problem 247
lazy_bunny
@lazyCoder036
Aug 11 2016 06:23
can any one short me out
cherry-geqi
@cherry-geqi
Aug 11 2016 06:23
@Masd925 but index 0, 4 and 1, 5 have the same numeric values, shouldn't we choose the minimum one?
John Magee
@jemagee
Aug 11 2016 06:23
@mitul036 sure- how much voltage do you need?:)
lazy_bunny
@lazyCoder036
Aug 11 2016 06:24
my code work perfectly on browser console but the problem is codecamp not approving it :( @jemagee
Markus Kiili
@Masd925
Aug 11 2016 06:24
@cherry-geqi First minimum pair is 0+4. Then those indices are out of use and the next one is 1+5.
lazy_bunny
@lazyCoder036
Aug 11 2016 06:24

function titleCase(str) {
    var holder = str.split(" ");
    var upperCase = [];
    var word = [];
    for( var i = 0; i < holder.length; i++){
        for(var j=0; j< holder[i].split("").length; j++){
            if(j == 0){
                word.push(holder[i].split("")[0].toUpperCase());
            }
            else if( j !== 0){
                word.push(holder[i].split("")[j].toLowerCase());
            }
            if( j == holder[i].split("").length - 1 ){
                word.push(" ");
            }
            upperCase[i] = word.join("");
        }

    }
    return upperCase[upperCase.length-1];
}

console.log(titleCase("sHoRt AnD sToUt"));
@jemagee you there ?
John Magee
@jemagee
Aug 11 2016 06:25
@mitul036 WHich test fails?
lazy_bunny
@lazyCoder036
Aug 11 2016 06:25
Every single one
@jemagee
@jemagee what exactly I am missing
:/
Greg Duncan
@GregatGit
Aug 11 2016 06:26
@mitul036 what does that return?
lazy_bunny
@lazyCoder036
Aug 11 2016 06:27
@GregatGit It returns this Short And Stout
Chris Cullen
@123xylem
Aug 11 2016 06:27

var Person = function(firstAndLast) {

firstAndLast=firstAndLast.split(" ");//split into first and second name by space

  this.getFirstName=function(){ //function to return first 
  return firstAndLast[0];};
    this.getLastName=function(){ // last
  return firstAndLast[1];};
    this.getFullName=function(){
  return firstAndLast[0]+ " "+ firstAndLast[1];}; //and full name

  this.setFirstName=function(name)  //function that makes first name = inputted name
  { firstAndLast[0]=name;
};
   this.setLastName=function(name) //same for last
  { firstAndLast[1]=name;
};
 this.setFullName=function(name)//This one is tricky....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!???????
  { firstAndLast=name;
};


};
var bob = new Person('Bob Ross');

bob.getFirstName();

Quick Object Question: How do i make a correct setFUllName Function.(bit where i have !!!???) I think the .split at the top is messing it up for .fullName as it just returns the first and second letter of first name when i do it like that.

On a side note Is therre a much better way for me to do this? I assume I couldve done something else but I always try my understanding first.

Greg Duncan
@GregatGit
Aug 11 2016 06:27
@mitul036 what should it return?
lazy_bunny
@lazyCoder036
Aug 11 2016 06:28
@GregatGit the taste cases are " titleCase("I'm a little tea pot") should return "I'm A Little Tea Pot".
titleCase("sHoRt AnD sToUt") should return "Short And Stout".
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") should return "Here Is My Handle Here Is My Spout". "
cherry-geqi
@cherry-geqi
Aug 11 2016 06:29
@123xylem

var Person = function(firstAndLast) {
  var fullName = firstAndLast;

  this.getFirstName = function() {
    return fullName.split(' ')[0];
  };

  this.setFirstName = function(first) {
    fullName = [first, fullName.split(' ')[1]].join(' ');
  };

  this.getLastName = function() {
    return fullName.split(' ')[1];
  };

  this.setLastName = function(last) {
    fullName = [fullName.split(' ')[0], last].join(' ');
  };

  this.getFullName = function() {
    return fullName;
  };

  this.setFullName = function(firstAndLast) {
    fullName = firstAndLast;
  };
};

var bob = new Person('Bob Ross');
bob.getFullName();
lazy_bunny
@lazyCoder036
Aug 11 2016 06:30
@GregatGit help help help :'(
Greg Duncan
@GregatGit
Aug 11 2016 06:30
@mitul036 it works
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:30
@jemagee i noticed that the test cases that work for you have a 1 as one of the numbers, when you get time check to see how it handles [5, 6] to see if it has something to do with 1 being an issue
Mark Todd
@Knochenmark
Aug 11 2016 06:30
@123xylem you would need to split the name again and then you can basically use your two setters
var Person = function(firstAndLast) {
  var name = firstAndLast.split(' ');
  var firstName = name[0];
  var lastName = name[1];

  this.getFirstName = function() {
    return firstName;
  };
  this.getLastName = function() {
    return lastName;
  };
  this.setFirstName = function(first) {
    firstName = first;
  };

  this.setLastName = function(last) {
    lastName = last;
  };
  this.getFullName = function () {
    return this.getFirstName() + " " + this.getLastName();
  };
  this.setFullName = function(firstAndLast) {
    var name = firstAndLast.split(' ');
    this.setFirstName(name[0]);
    this.setLastName(name[1]);
  };
};
cherry-geqi
@cherry-geqi
Aug 11 2016 06:31
@Masd925 thanks, may i have missed something...
CamperBot
@camperbot
Aug 11 2016 06:31
cherry-geqi sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2272 | @masd925 |http://www.freecodecamp.com/masd925
Elbert Cortez
@trip16661
Aug 11 2016 06:31
the identation @cherry-geqi you are splitting the object mutipl times I think the best way us to create a simple array with it
lazy_bunny
@lazyCoder036
Aug 11 2016 06:31
@GregatGit it works for console
John Magee
@jemagee
Aug 11 2016 06:31
@jarenescueta731 actually - the issue as the code was written is the 18-23 - i know it fails - i've already figured that out - it has to do with the repeating primes in numbers like 18 (2 3's) and 20 (2, 2's) that haven't been includede yet 0- i'm trying another track regarding the factorials
lazy_bunny
@lazyCoder036
Aug 11 2016 06:31
@GregatGit but not passing through on codecamp
Mark Todd
@Knochenmark
Aug 11 2016 06:32
@mitul036 link your code
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:32
@jemagee okeedoke
John Magee
@jemagee
Aug 11 2016 06:32
I apologize for making anyone look at dirty cod e- i know most of the code posted here is elegant and pristine - sorry for the odor
cherry-geqi
@cherry-geqi
Aug 11 2016 06:32
@trip16661 that makes sense.
manusia123
@manusia123
Aug 11 2016 06:32
okay this might be a stupid question but how do post a picture like above ?
Christian
@Neralizer
Aug 11 2016 06:32
alright, I'm confused as to why my return is as such
function largestOfFour(arr) {
  var lrg = 0, newArr = [];
  for (var i = 0; i < arr.length; i++)
  for (var j = 0; j < arr[i].length; j++)
    if (lrg < arr[i][j]){
      lrg = arr[i][j];
      newArr.push(lrg);
    }

  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Markus Kiili
@Masd925
Aug 11 2016 06:33
@Neralizer You need to initialize the lrg for each subarray.
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:33
@manusia123 it's not a screenshot, you use the formatting
@manusia123 three backticks
help format
CamperBot
@camperbot
Aug 11 2016 06:33

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Jaren Escueta
@jarenescueta731
Aug 11 2016 06:34
@manusia123 ^
silver537
@silver537
Aug 11 2016 06:34
@jemagee who cares if ya don't like me. its the code you should be interested in. you said a dumbass statement and im rebutting with a better argument.
gcd=(x, y)=>{
    return (y===0)? x : gcd(y, x % y);
};
smallestCommons=arr=>{
    arr.sort((a,b)=>a-b);
    var array=[];
    for(var x=arr[0];x<=arr[1];x++){
        array.push(x);
    }
    var scm=arr[0];
    array.forEach((y)=>{
        scm=scm*y/gcd(scm,y);     
    });
    return scm;
};
smallestCommons([6,9]);
lcmSol.gif
i followed this formula :point_up:
Christian
@Neralizer
Aug 11 2016 06:34
@Masd925 do I do that by pushing lrg[i] or something like that?
Jaren Escueta
@jarenescueta731
Aug 11 2016 06:34
lol wut. be nice, we're all volunteers
Mark Todd
@Knochenmark
Aug 11 2016 06:35
@mitul036 your string has a whitespace at the end. thats why its failing
manusia123
@manusia123
Aug 11 2016 06:35
@jarenescueta731 thx a lot
CamperBot
@camperbot
Aug 11 2016 06:35
manusia123 sends brownie points to @jarenescueta731 :sparkles: :thumbsup: :sparkles:
:cookie: 353 | @jarenescueta731 |http://www.freecodecamp.com/jarenescueta731
John Magee
@jemagee
Aug 11 2016 06:35
@silver537 I'm thrilled you understand that formula - but like i previously said - someone sent that to me earlier and it didn't make sense to me because i haven't had a single use for algebra in 20 years since i got my masters degree
Markus Kiili
@Masd925
Aug 11 2016 06:35
@Neralizer Assign 0 or -Infinity to lrg after the i loop definition before j loop.
lazy_bunny
@lazyCoder036
Aug 11 2016 06:35
@Knochenmark thanks :D
CamperBot
@camperbot
Aug 11 2016 06:35
mitul036 sends brownie points to @knochenmark :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @knochenmark |http://www.freecodecamp.com/knochenmark
John Magee
@jemagee
Aug 11 2016 06:35
@jarenescueta731 you know this is the internet right? People take advantage of their anonymity to be douchey tough guys
Christian
@Neralizer
Aug 11 2016 06:36
@Masd925 that's giving me an error, now it can't read the length property
silver537
@silver537
Aug 11 2016 06:37
@jemagee excuses wont get you far.
John Magee
@jemagee
Aug 11 2016 06:37
Sigh - yet another person making me long for an ignore function - thinks they're being helpful but really just saying 'hey look how much better i am than you so i can stroke my small ego'
silver537
@silver537
Aug 11 2016 06:37
but hey, if your solution works, by all means congratulations.
Christian
@Neralizer
Aug 11 2016 06:37
and if I don't declare the variable until after that I get scope errors
Markus Kiili
@Masd925
Aug 11 2016 06:38
@Neralizer Check that you have all the loop block brackets correctly there.
@Neralizer Loops don't make new scope in JS.
Mark Todd
@Knochenmark
Aug 11 2016 06:39
@Neralizer i think you should add curly brackets to your loops
lazy_bunny
@lazyCoder036
Aug 11 2016 06:39
hello again, can any one give a compact and more optimized version of this code ?
Chris Cullen
@123xylem
Aug 11 2016 06:39
@cherry-geqi @Knochenmark thanks looking into it now
CamperBot
@camperbot
Aug 11 2016 06:39
123xylem sends brownie points to @cherry-geqi and @knochenmark :sparkles: :thumbsup: :sparkles:
:cookie: 403 | @knochenmark |http://www.freecodecamp.com/knochenmark
:cookie: 282 | @cherry-geqi |http://www.freecodecamp.com/cherry-geqi
lazy_bunny
@lazyCoder036
Aug 11 2016 06:39

function titleCase(str) {
    var holder = str.split(" ");
    var upperCase = [];
    var word = [];
    for( var i = 0; i < holder.length; i++){
        for(var j=0; j< holder[i].split("").length; j++){
            if(j == 0){
                word.push(holder[i].split("")[0].toUpperCase());
            }
            else if( j !== 0){
                word.push(holder[i].split("")[j].toLowerCase());
            }
            if( j == holder[i].split("").length - 1 && i !== holder.length - 1 ){
                word.push(" ");
            }
            upperCase[i] = word.join("");
        }

    }
    return upperCase[upperCase.length-1];
}

console.log(titleCase("sHoRt AnD sToUt"));
Mark Todd
@Knochenmark
Aug 11 2016 06:39
otherwise the if is not in your first loop
lazy_bunny
@lazyCoder036
Aug 11 2016 06:39
@Knochenmark
Mark Todd
@Knochenmark
Aug 11 2016 06:39
@mitul036 still wrong?
lazy_bunny
@lazyCoder036
Aug 11 2016 06:39
nope
@Knochenmark
but need to find a better alternative
@Knochenmark as this code look horrible :/
manusia123
@manusia123
Aug 11 2016 06:40
function updateRecords(id, prop, value) {
  if(id[prop] === null ){
  id[prop] = value;
  }

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

  return collection;
}
Christian
@Neralizer
Aug 11 2016 06:40
okay, I added my brackets
manusia123
@manusia123
Aug 11 2016 06:40
oh wait wrong code
Mark Todd
@Knochenmark
Aug 11 2016 06:40
@mitul036 want to see my solution? :D
Christian
@Neralizer
Aug 11 2016 06:40
This message was deleted
sorry
lazy_bunny
@lazyCoder036
Aug 11 2016 06:40
@Knochenmark why not :D
Christian
@Neralizer
Aug 11 2016 06:41
function largestOfFour(arr) {
  var lrg = 0, newArr = [];
  for (var i = 0; i < arr.length; i++){
  for (var j = 0; j < arr[i].length; j++){
    if (lrg < arr[i][j]){
      lrg = arr[i][j];
      newArr.push(lrg);
    }
    }
    }

  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Markus Kiili
@Masd925
Aug 11 2016 06:41
@Neralizer Initialize lrg after i loop definition and push only after j loop block.
Mark Todd
@Knochenmark
Aug 11 2016 06:41
function titleCase(str) {
  var arr = str.split(" ").map(function(item){
    var itemStr = item.toLowerCase();
    return itemStr.charAt(0).toUpperCase() + itemStr.substr(1);
  });
  return arr.join(" ");
}
Mateusz Szymański
@matszym
Aug 11 2016 06:41
@mitul036

function titleCase(str) {

  return str.split(' ')
    .map(function(element){
      element = element.toLowerCase().split('');
      element[0] = element[0].toUpperCase();

      return element.join('');
    })
    .join(' ');
}

titleCase("I'm a little tea pot");
Christian
@Neralizer
Aug 11 2016 06:41
by initialize, you mean declare?
manusia123
@manusia123
Aug 11 2016 06:41
function updateRecords(id, prop, value) {
  if(id[prop] === null ){
  id[prop] = value;
  }

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

  return collection;
}
so how can we insert a value into an existing array ? because when i do this its say push is not defined
lazy_bunny
@lazyCoder036
Aug 11 2016 06:42
@Knochenmark damn :/
Markus Kiili
@Masd925
Aug 11 2016 06:42
@Neralizer