These are chat archives for FreeCodeCamp/HelpJavaScript

22nd
Aug 2016
Stephen James
@sjames1958gm
Aug 22 2016 00:03
@kantrakantra String and Array are built in objects that supply functions for their respective types.
The .prototype part is part of javascript inheritance through prototypes.
Almette
@almette
Aug 22 2016 00:04

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

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

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Stephen James
@sjames1958gm
Aug 22 2016 00:04
So Array.prototype.slice is the slice function for all arrays, but you can reference it like this and use it for arguments which is an array-like object
Almette
@almette
Aug 22 2016 00:04
This is the original code
I still don't get it :(
Egoscio
@Egoscio
Aug 22 2016 00:09
@almette What seems to be your issue?
I only see some code which seems to be incomplete
Almette
@almette
Aug 22 2016 00:10
it doesn't pass
yes, it is just what I have to do
I don't know how to fix the previous one
function update(id, prop, value) {
if (!value) delete collection[id][prop];
if (!!value && prop === 'tracks') collection[id][prop].push(value);
if (!!value && prop === 'artist') collection[id][prop] = value;
return collection;
something is wrong here
Stephen James
@sjames1958gm
Aug 22 2016 00:12
@almette Is it passing any tests?
Almette
@almette
Aug 22 2016 00:13
yes
exept one
except
Stephen James
@sjames1958gm
Aug 22 2016 00:13
@almette The one with 5439? The one that doesn't have a tracks array to push onto?
Almette
@almette
Aug 22 2016 00:13
After updateRecords(5439, "artist", "ABBA"), artist should be "ABBA"
After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element.
After updateRecords(2548, "artist", ""), artist should not be set
After updateRecords(1245, "tracks", "Addicted to Love"), tracks should have "Addicted to Love" as the last element.
After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element.
After updateRecords(2548, "tracks", ""), tracks should not be set
second one
Kantra
@removed~kantrakantra
Aug 22 2016 00:14
Ok, last question regarding this solution. What the meaning of .map in this code?
function rot13(str) {

  return str.split('')

    .map.call(str, function(char) {

      x = char.charCodeAt(0);

      if (x < 65 || x > 90) {
        return String.fromCharCode(x);  
      }

      else if (x < 78) {
        return String.fromCharCode(x + 13);
      }

      return String.fromCharCode(x - 13);
    }).join('');  // Rejoin the array into a string
}
Stephen James
@sjames1958gm
Aug 22 2016 00:14
@kantrakantra I am holding you to one last question :)
Egoscio
@Egoscio
Aug 22 2016 00:14
@almette Not sure if this is the solution, but before push'ing anything, you should make sure the target is indeed an array.
Kantra
@removed~kantrakantra
Aug 22 2016 00:15
@sjames1958gm I'm sorry which one
Stephen James
@sjames1958gm
Aug 22 2016 00:15
@kantrakantra This one :)
Kantra
@removed~kantrakantra
Aug 22 2016 00:15
@sjames1958gm Oh hah I didnt get what u meant at first
Egoscio
@Egoscio
Aug 22 2016 00:16
If the tracks property does not exist, you'll receive a runtime error, because the target won't have the push method.
Almette
@almette
Aug 22 2016 00:16
yes, @Egoscio that is the issue too
do you have a code in mind ?
i can't finish because of this
Stephen James
@sjames1958gm
Aug 22 2016 00:17
@sjames1958gm map is a function on an array that calls a function (that you provide) once for every entry in the array.
map then takes each return value from that function and builds a new array. So it maps the values of the function to new values.
In this case it is mapping the character to its ciphered value.
Kantra
@removed~kantrakantra
Aug 22 2016 00:17
Essentially how is .map able to work without it being connected to anything?
Stephen James
@sjames1958gm
Aug 22 2016 00:18
@almette you need to add code to your second if that tests for the property tracks on collection[id], if there push, if not there assign an empty array and then push.
It is described in the instructions
@kantrakantra It is a continuation of the previous line the white space is not significant. Equivalent to:
str.split('').map.call
Elizabeth Crummy
@lizzyac
Aug 22 2016 00:19

I'm stuck on the counting cards challenge. I'm not sure how to get the counts to add and subtract for each case. This is my code so far: var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case (2):
return "+1 Bet";
case (3):
return "+1 Bet";
case (4):
return "+1 Bet";
case (5):
return "+1 Bet";
case (6):
return "+1 Bet";
break;
case (7):
return "0 Hold";
case (8):
return "0 Hold";
case (9):
return "0 Hold";
break;
default:
return "-1 Hold";
}
}

// Only change code above this line

// Add/remove calls to test your function.
// Note: Only the last will display
cc(10); cc('J'); cc('Q'); cc('K'); cc('A');
Any help would be great!

Rohan Gandhi
@CheeseAndToasted
Aug 22 2016 00:20
hi I am trying to do the weather front end challenge
the code seems to error when converting to fahrenheit since it doesnt round correctly.
it also wont switch back to celcius after for some reason
it may not work in codepen but it works in my browser if you could please help
http://codepen.io/RohanGandhi/pen/YWbzyX
Stephen James
@sjames1958gm
Aug 22 2016 00:20
@lizzyac count = count + 1; or count++ or count +=1 - you don't do anything with the string until after the switch and you compare count to zero
Kantra
@removed~kantrakantra
Aug 22 2016 00:20
@sjames1958gm ah thx
CamperBot
@camperbot
Aug 22 2016 00:20
kantrakantra sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2781 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Egoscio
@Egoscio
Aug 22 2016 00:20
@almette I'd prefer guiding you rather than giving the answer :) First, use an if statement block rather than a one liner. In that block, store a variable that references to the target so you don't repeat yourself. Then have an if statement which checks if the target is not an array, which sets the target to an array and finally pushes it.
lloan alas
@ledkyb
Aug 22 2016 00:22
Someone mind explaining what Everything Be True challenge wants? Seems kind of vague to me. (https://www.freecodecamp.com/challenges/everything-be-true)
Egoscio
@Egoscio
Aug 22 2016 00:23
if (!!value && prop === 'tracks') {
    var target = collection[id][prop]
    if (target is not an array) {
        target = []
    }
    target.push(value)
}
Elizabeth Crummy
@lizzyac
Aug 22 2016 00:23
I will try that, thanks @sjames1958gm !
CamperBot
@camperbot
Aug 22 2016 00:23
lizzyac sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Egoscio
@Egoscio
Aug 22 2016 00:23
You have to figure out what implementation you wanna use for checking if it's an array
CamperBot
@camperbot
Aug 22 2016 00:23
:star2: 2782 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 22 2016 00:24
@lizzyac :+1:
Egoscio
@Egoscio
Aug 22 2016 00:24
@almette From the top of my head, if (target.constructor !== Array) might work.
Almette
@almette
Aug 22 2016 00:25
@Egoscio I'm at the edge
all day with my eyes in the comp
ok
;)
Ezequiel Kohon
@ezekohon
Aug 22 2016 00:27
Hi!
Almette
@almette
Aug 22 2016 00:27
one more question.. how do I post like you did, the black background? is it like screen shot?
Ezequiel Kohon
@ezekohon
Aug 22 2016 00:27
Can't figure how to make the Tweet button work, someone can see the mistake? http://codepen.io/ezekohon/pen/vKrPNL
Egoscio
@Egoscio
Aug 22 2016 00:27
Use triple tilde's
`
```javascript
// code
```
err
Almette
@almette
Aug 22 2016 00:28
`?
Egoscio
@Egoscio
Aug 22 2016 00:29
Yeah, use three of those at the beginning and end of your code.
Almette
@almette
Aug 22 2016 00:29
gotcha
Egoscio
@Egoscio
Aug 22 2016 00:29
you can specify the language by putting it on the same line as the first set of tilde's. It's kind of hard to explain because if I try to show you it screws up
Almette
@almette
Aug 22 2016 00:30
why do I need to specify it ? or just in case I do..
Moisés Man
@moigithub
Aug 22 2016 00:31
diff colors
Egoscio
@Egoscio
Aug 22 2016 00:32
Yeah, syntax highlighting.
Moisés Man
@moigithub
Aug 22 2016 00:32
```js <---js colors
```css
```text <-- no colors
```html
Almette
@almette
Aug 22 2016 00:33
:)) I'm such a beginner
myke2424
@myke2424
Aug 22 2016 00:33
how do you copy and paste your code screenshot
Moisés Man
@moigithub
Aug 22 2016 00:33
```js
code on next line.. shift enter if needed
```
@myke2424
myke2424
@myke2424
Aug 22 2016 00:34
var removedFromMyArray = myArray.pop();
var myArray = [["John", 23], ["cat", 2 ].pop()];
I don't get why this isn't working
myArray should only contain [["John", 23]].
and i'm getting this output myArray = [["John",23],2] & removedFromMyArray = ["cat",2]
Moisés Man
@moigithub
Aug 22 2016 00:35
pop mutate the array (change the original array) @myke2424
i think u should NOT reassign values to myArray.. dont recall the instructions...
myke2424
@myke2424
Aug 22 2016 00:37
i didn't reassign anything
Moisés Man
@moigithub
Aug 22 2016 00:37
thats all the code ?? n whats the instructions ??
myke2424
@myke2424
Aug 22 2016 00:38
Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
I don't get why the ", 2" is still in the array but it says it has been removed as well
Moisés Man
@moigithub
Aug 22 2016 00:39
n thats all the code ?? or have more lines on ur screen ??
can u post em all ??
var aaa = 1;
aaa = 2; <--- this mean reassign values to the variable aaa ( ushould NOT reasign)
myke2424
@myke2424
Aug 22 2016 00:40
'''js'''
CamperBot
@camperbot
Aug 22 2016 00:40
:bulb: to format code use backticks! ``` more info
myke2424
@myke2424
Aug 22 2016 00:40
```js

// Example
var ourArray = [1,2,3];
var removedFromOurArray = ourArray.pop(); 
// removedFromOurArray now equals 3, and ourArray now equals [1,2]

// Setup
var myArray = [["John", 23], ["cat", 2]];

// Only change code below this line.
var removedFromMyArray = myArray.pop();
var myArray = [["John", 23], ["cat", 2 ].pop()];
Egoscio
@Egoscio
Aug 22 2016 00:41
remove .pop() from the myarray declaration
Moisés Man
@moigithub
Aug 22 2016 00:41
var myArray = [["John", 23], ["cat", 2]];  // original value

// Only change code below this line.
var removedFromMyArray = myArray.pop();
var myArray = [["John", 23], ["cat", 2 ].pop()];  /// u reassign values here.. remove this line
@myke2424 do u understand what pop method does ??? and what it returns ?? (did u checked the documentation ?? )
myke2424
@myke2424
Aug 22 2016 00:43
yea
Egoscio
@Egoscio
Aug 22 2016 00:43
It removes the last item from the referenced array and returns said item.
Moisés Man
@moigithub
Aug 22 2016 00:43
what it does ??
and what it return ??
Egoscio
@Egoscio
Aug 22 2016 00:43
^
myke2424
@myke2424
Aug 22 2016 00:44
yea
Moisés Man
@moigithub
Aug 22 2016 00:44
:+1:
Egoscio
@Egoscio
Aug 22 2016 00:44
bah I thought he was stuck :P
Moisés Man
@moigithub
Aug 22 2016 00:44
pop mutates/changes the original array

soo if u have
var myArray = [["John", 23], ["cat", 2]]; // original value

and do
var removedFromMyArray = myArray.pop();

myArray will end with [["John", 23] only
Egoscio
@Egoscio
Aug 22 2016 00:45
it becomes [["John", 23]]
Moisés Man
@moigithub
Aug 22 2016 00:45
yep :)
and removedFromMyArray will have ["cat" , 2]
myke2424
@myke2424
Aug 22 2016 00:47
thanks guys, i feel dumb now lol
Egoscio
@Egoscio
Aug 22 2016 00:48
Don't be, we all start somewhere :)
Almette
@almette
Aug 22 2016 00:54
// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
if (!!value && prop === 'tracks') {
    var target = collection[id][prop];
    if (target.constructor !== Array) {
        target = [];
    }
    target.push(value);
}
return collection;






// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
doesn't pass
Egoscio
@Egoscio
Aug 22 2016 00:55
The if statement should be inside the updateRecords function
Where'd the function go?
function updateRecords (id, prop, value) { /*insert if statement here*/ }
Almette
@almette
Aug 22 2016 01:02
// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
   if (!!value && prop === 'tracks') {
    var target = collection[id][prop];
    if (target.constructor !== Array) {
        target = [];
    }
    target.push(value);
}


  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Egoscio
@Egoscio
Aug 22 2016 01:03
:+1:
Almette
@almette
Aug 22 2016 01:03
not working
tfmlol
@tfmlol
Aug 22 2016 01:03
Hey guys, I'm relatively new here. Can someone tell me where the passed variables are defined in the Word Blanks section?
Egoscio
@Egoscio
Aug 22 2016 01:04
@almette Which test is not passed?
Almette
@almette
Aug 22 2016 01:04
After updateRecords(5439, "artist", "ABBA"), artist should be "ABBA"
After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element.
After updateRecords(2548, "artist", ""), artist should not be set
After updateRecords(1245, "tracks", "Addicted to Love"), tracks should have "Addicted to Love" as the last element.
After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element.
After updateRecords(2548, "tracks", ""), tracks should not be set
the first three and last
Egoscio
@Egoscio
Aug 22 2016 01:06
Well you also need the other 2 if statements you showed previously
if !value was one of them
The if statement I suggested was an addition, not a replacement to the other code
Mercifex
@Mercifex
Aug 22 2016 01:06
why does FCC use == and not ===?
oh wait, nvm
*facepalm
Egoscio
@Egoscio
Aug 22 2016 01:08
@Mercifex Using == is labeled as a bad act in most (if not all) cases
^ javascript bible
Maximiliaan Strother III
@Mdlkxzmcp
Aug 22 2016 01:14
Anyone knows what I'm actually supposed to do in Word Blanks?
Egoscio
@Egoscio
Aug 22 2016 01:16
@Mdlkxzmcp Looking at it right now.
Almette
@almette
Aug 22 2016 01:17
result += "The "+myAdjective+" "+myNoun+" "+myVerb+" "+myAdverb+"."; @Mdlkxzmcp
Maximiliaan Strother III
@Mdlkxzmcp
Aug 22 2016 01:17
@almette oh that's it? I thought it is like a small project thingy or something
@almette thank you!
CamperBot
@camperbot
Aug 22 2016 01:17
mdlkxzmcp sends brownie points to @almette :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for almette
Kantra
@removed~kantrakantra
Aug 22 2016 01:33
Can anybody tell me what's wrong with my code?
function rot13(str) {
  var img = str.split("").replace(/\W/g, '');
  if (img[0].charCodeAt() >= 65 && img[0].charCodeAt() <= 158) {
    img.join("");
    img.fromCharCode(img + 13);
    return img;

  }

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Egoscio
@Egoscio
Aug 22 2016 01:34
Not really evident what you're trying to achieve
Also, split returns an array. IIRC an array doesn't have a replace method.
Try putting split at the end of the img declaration
@kantrakantra ^
Egoscio
@Egoscio
Aug 22 2016 01:52
Your code should have a structure as follows:
function rot13(str) {
  return str.split('').map(function (a) {

  }).join('');
}
inside the map function, you should return each character after passing it through the shift algorithm.
String.fromCharCode(a.charCodeAt() - 13) seems like the way to go, but there seems to be some other logic behind it
Mike
@MikeJSchorah
Aug 22 2016 02:07
Does anyone know... If I learn JavaScript and know it pretty well, how difficult will it be to learn Java?
Egoscio
@Egoscio
Aug 22 2016 02:10
@MikeJSchorah Javascript is much more lenient comparing to java. In JS you don't have to specify a type for variables. Lots of inference is done.
To be quite frank, Javascript teaches you some bad habits because of how much freedom it provides. As someone said earlier, 1 + "someString" should usually return an error in other languages, but in JS it goes without an issue
there's some downsides to this freedom, which you won't really realize until further on if you're new to programming. unpredictability.
Egoscio
@Egoscio
Aug 22 2016 02:15
The typical learning process for programming starts off with Scratch followed by HTML/CSS/Javascript and then eventually Java (typically highschool going up to AP computer science). Before, C was a common introductory language in colleges .
Anthony Drane
@Antiaccess
Aug 22 2016 02:16
@sjames1958gm Thanks mate! I just got home and looked at your message, then made my code simpler:
function confirmEnding(str, target) {
  str = str.split(" ");
  var strEnd = str[str.length - 1];
  if (strEnd.substr((strEnd.length - target.length), strEnd.length) == target){
    return true;
  }
  return false;
}

confirmEnding("Open sesame", "same")
CamperBot
@camperbot
Aug 22 2016 02:16
antiaccess sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2784 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Anthony Drane
@Antiaccess
Aug 22 2016 02:17
@sjames1958gm any reason you think my thought process might have gone to the clunky method rather than the streamlined more efficient one?
Mike
@MikeJSchorah
Aug 22 2016 02:19
@Egoscio I learned JavaScript in CodeCademy, W3 Schools, A Smarter Way to Learn JavaScript and I'm learning on FCC. But I wanted to do a boot camp on Java. Am I looking at a more difficult time than I thought?
Egoscio
@Egoscio
Aug 22 2016 02:20
@MikeJSchorah I too started at CodeCademy, and eventually branched away to stackoverflow and blog posts. You typically wanna avoid W3 schools and stick with Mozilla Dev Network. I don't think you'll have any difficulty, you will only be introduced to certain concepts that Javascript completely neglects.
Mike
@MikeJSchorah
Aug 22 2016 02:22
I know that it will be easier for me than someone with 0 experience, but how much easier? Will they be able to catch up to me in a week? A Month?
Egoscio
@Egoscio
Aug 22 2016 02:22
Type safety in Java, for example, stops you from assigning a String to a variable which was initially declared as a number.
Programming languages typically have the same concepts, once you understand them once, you can most of the time understand other similar languages. From a naked eye, lots of things in Java and Javascript seems similar.
Anthony Drane
@Antiaccess
Aug 22 2016 02:23
Hey guys, I passed the tests on the 'repeat string 'num' amount of times' BUT i don't think I did it the way they had in mind (using Global String Object). Here's my code, but how could it be done 'their way'?
function repeatStringNumTimes(str, num) {
  var strCopy = str;
  if (num > 0){
    for (var i = 1; i < num; i++){
      str+=strCopy;
    }
    return str;
  }
  return "";
}

repeatStringNumTimes("abc", 3);
Egoscio
@Egoscio
Aug 22 2016 02:24
Javascript is even trying to adopt certain things from Java, such as classes (which are basically syntax sugar for functions in JS's case)
Mike
@MikeJSchorah
Aug 22 2016 02:24
@Egoscio Even advanced concepts like algorithms?
Angel J Piscola
@Redmega
Aug 22 2016 02:24
Algorithms aren't that advanced :laughing:
Mike
@MikeJSchorah
Aug 22 2016 02:24
@Redmega For me they are >D
Angel J Piscola
@Redmega
Aug 22 2016 02:24
@Antiaccess Looks fine to me. What do you mean "Global String Object"? Nothing there has global scope
@MikeJSchorah Do you know how to use a for loop
Mike
@MikeJSchorah
Aug 22 2016 02:25
Lol. Yes
Anthony Drane
@Antiaccess
Aug 22 2016 02:25
@Redmega they just had 'here are some helpful links: ' and linked to Global String Object for some reason
Angel J Piscola
@Redmega
Aug 22 2016 02:25
THen you already know a (simple) algorithm
i++
Egoscio
@Egoscio
Aug 22 2016 02:25
@MikeJSchorah At some times in your programming career (or if you're doing it simply for fun), you will probably look at concepts from github repositories from languages you haven't even learnt from and use them in your own project.
Mike
@MikeJSchorah
Aug 22 2016 02:26
@Redmega Ok. I was talking about the problems in FCC's Basic Algorithms, lol
Angel J Piscola
@Redmega
Aug 22 2016 02:26
@Antiaccess Don't worry about it. You solved it just fine.
Egoscio
@Egoscio
Aug 22 2016 02:26
Algorithms aren't necessarily language dependent, it's just conveyed in a different way from language to language.
Anthony Drane
@Antiaccess
Aug 22 2016 02:26
@Redmega ok, thanks
CamperBot
@camperbot
Aug 22 2016 02:26
antiaccess sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 92 | @redmega |http://www.freecodecamp.com/redmega
Mike
@MikeJSchorah
Aug 22 2016 02:27
@Egoscio Exactly. I'm having difficulty with the Basic Algorithms section of FCC. The rest seemed easy, but I have experience elsewhere with JavaScript. I don't have any experience with Java. I'm just wondering how I'll do in a boot camp based in Java...
Egoscio
@Egoscio
Aug 22 2016 02:28
I recommend looking at some projects on github written in Java and see what you do understand.
Mike
@MikeJSchorah
Aug 22 2016 02:28
Like if it takes a noob 90 hours a week for 12 weeks to learn Java, I'm wondering if it will take me only 60 hours a week...
Egoscio
@Egoscio
Aug 22 2016 02:28
I have a friend who writes code in Java, and I'm able to help him sometimes even though I never studied it thoroughly.
Mike
@MikeJSchorah
Aug 22 2016 02:29
@Egoscio I'm not too familiar with GitHub. Just started learning a month ago. Could I do a simple search for Java projects?
Pogg
@fogkio
Aug 22 2016 02:29
helppp
Egoscio
@Egoscio
Aug 22 2016 02:30
Mike
@MikeJSchorah
Aug 22 2016 02:30
Thanks @Egoscio
CamperBot
@camperbot
Aug 22 2016 02:30
mikejschorah sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:cookie: 19 | @egoscio |http://www.freecodecamp.com/egoscio
Egoscio
@Egoscio
Aug 22 2016 02:30
These are popular repositories written in Java. You can scan through a few and see what you'll eventually be dealing with.
Angel J Piscola
@Redmega
Aug 22 2016 02:31
Your goal isn't to learn javascript
or to learn java
Or C
Your goal is to learn how to program
Egoscio
@Egoscio
Aug 22 2016 02:31
Don't be overwhelmed if you don't understand something. Research it :) Experience is acquired gradually, you just need to be ready learn.
Mike
@MikeJSchorah
Aug 22 2016 02:31
@Egoscio They all use XML?
Angel J Piscola
@Redmega
Aug 22 2016 02:31
Once you grasp that, you'll be able to apply your skills to any language. It's just a matter of learning the syntax.
Egoscio
@Egoscio
Aug 22 2016 02:32
XML is like Javascript's JSON. It's just a way of listing relations and properties in a markup language.
Mike
@MikeJSchorah
Aug 22 2016 02:32
@Redmega That's what I thought, but I heard different opinions. A few people said that a noob will be able to catch up to me in a month or two... but that is Yahoo Answers, lol
Pogg
@fogkio
Aug 22 2016 02:33
``js
Mike
@MikeJSchorah
Aug 22 2016 02:33
@Egoscio Right, it seems to be popular with Java, from what I'm looking at right now...
Pogg
@fogkio
Aug 22 2016 02:33
``js
Angel J Piscola
@Redmega
Aug 22 2016 02:33
@MikeJSchorah I wouldn't worry too much about what people on the web say
Egoscio
@Egoscio
Aug 22 2016 02:33
I don't see why you're worried about that. It's not how fast you learn a language, it's how well you do so.
Angel J Piscola
@Redmega
Aug 22 2016 02:33
Check out that bundle if you want some good resources
Pogg
@fogkio
Aug 22 2016 02:34
how can i show my code
Angel J Piscola
@Redmega
Aug 22 2016 02:34
I recommend doing the $15 and getting Think Like a Programmer: An Introduction to Creative Problem Solving by No Starch Press
That's a great book which helped me a lot when I started off
@fogkio Copy and paste it between two sets of ```
help format
CamperBot
@camperbot
Aug 22 2016 02:34
no wiki entry for: format
Egoscio
@Egoscio
Aug 22 2016 02:34
@fogkio Sure, post it in code format with triple tilde
Pogg
@fogkio
Aug 22 2016 02:34

// 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");
Angel J Piscola
@Redmega
Aug 22 2016 02:34
There you go
Mike
@MikeJSchorah
Aug 22 2016 02:35
@Egoscio Well... I'd have to grasp Java pretty well in 12 weeks to get an internship. But, I'm not too worried... out of 25 people, only 2 didn't get an internship
Pogg
@fogkio
Aug 22 2016 02:35
i stuck in here
Angel J Piscola
@Redmega
Aug 22 2016 02:35
@MikeJSchorah Year Up, by any chance?
Pogg
@fogkio
Aug 22 2016 02:35
what mah mistake? bro
Ian Hale
@coloradomountain
Aug 22 2016 02:35
Hi
Egoscio
@Egoscio
Aug 22 2016 02:35
@fogkio Remove the quotes for checkProg
Angel J Piscola
@Redmega
Aug 22 2016 02:35
:wave:
Egoscio
@Egoscio
Aug 22 2016 02:35
wait
ignore me
Ian Hale
@coloradomountain
Aug 22 2016 02:36

Can someone help with my filter

function check(t) {
if(t === "" || t === null || t === 0 || isNaN(t) || t === false || t === undefined)
return false;

else 
  return true;

}

Ian Hale
@coloradomountain
Aug 22 2016 02:36

function check(t) {
if(t === "" || t === null || t === 0 || isNaN(t) || t === false || t === undefined)
return false;

else
return true;

}

Angel J Piscola
@Redmega
Aug 22 2016 02:36
``
```
Egoscio
@Egoscio
Aug 22 2016 02:36
Replace myObj.checkProp; with myObj[checkProp];
Angel J Piscola
@Redmega
Aug 22 2016 02:36
Is there something up with the bot tonight? It's not saying what its supposed to
Ian Hale
@coloradomountain
Aug 22 2016 02:37
s.filter(check); any help?
Pogg
@fogkio
Aug 22 2016 02:38
nothing change bro
i tried
Egoscio
@Egoscio
Aug 22 2016 02:39
@coloradomountain you can just do:
s.filter(function (t) { return !!t })
Angel J Piscola
@Redmega
Aug 22 2016 02:39
@fogkio Please see that link I sent you, you are confusing your dot and bracket notation. If you need more help let me know
@Egoscio Stop solving it for them ;)
Ian Hale
@coloradomountain
Aug 22 2016 02:39
@Egoscio I also found this cool page from https://developer.mozilla.org/en-US/docs/Glossary/Falsy thought i should use a switch.
Angel J Piscola
@Redmega
Aug 22 2016 02:40
Also, !!?
Ian Hale
@coloradomountain
Aug 22 2016 02:40
!! makes sense though, definately not equal
Angel J Piscola
@Redmega
Aug 22 2016 02:40
The definition of falsy is that it returns false, you don't need to return not not false
not not false is false
lol
It converts whatever value to a bool
Angel J Piscola
@Redmega
Aug 22 2016 02:41
Not converts, coerces
What I'm saying is that the javascript engine will do that on check of the filter anyway

Proof:

function bouncer(r){
    return r.filter(x=>x);
}

passes

that's ecmascript 6 for function(x){return x;}, fyi
Egoscio
@Egoscio
Aug 22 2016 02:42
It does indeed. I've just lost my "javascript touch". Swift is teaching me to use type safety so I only give filter functions bools now :P
Angel J Piscola
@Redmega
Aug 22 2016 02:43
Mm
Pogg
@fogkio
Aug 22 2016 02:43
i need a suggest about my solve @Egoscio
Angel J Piscola
@Redmega
Aug 22 2016 02:43
I tend to stay away from iOS due to the high cost of development. I don't have a mac or macbook, basically
Egoscio
@Egoscio
Aug 22 2016 02:44
Swift is open source now, you can run it on linux.
Server side swift brotha
That's why I've ditched 2 years of Node experience.
Angel J Piscola
@Redmega
Aug 22 2016 02:44
Tru but to compile to an iOS app?
Egoscio
@Egoscio
Aug 22 2016 02:44
Swift is not only iOS. You can write an operating system with it.
Angel J Piscola
@Redmega
Aug 22 2016 02:44
Fair enough. I'd mainly use it for coding apps, though
I've recently gotten into Nativescript
Egoscio
@Egoscio
Aug 22 2016 02:45
@fogkio Your problem was using dot notation rather than brackets. I suggested you switch it. That did not work?
Angel J Piscola
@Redmega
Aug 22 2016 02:45
Typescript which gets compiled into Swift and Android Java, so you code once and run cross platform.
Egoscio
@Egoscio
Aug 22 2016 02:45
@Redmega I didn't like Nativescript's UI from the examples they show. personally found it hideous
(personally speaking)
Angel J Piscola
@Redmega
Aug 22 2016 02:46
It's the native OS UI.. lol
Pogg
@fogkio
Aug 22 2016 02:46
yep it's didnt work
@Egoscio
Egoscio
@Egoscio
Aug 22 2016 02:46
@fogkio Please repost your code with the added changes
Pogg
@fogkio
Aug 22 2016 02:47

// 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");
Egoscio
@Egoscio
Aug 22 2016 02:47
@Redmega The reason I find it ugly is because of the write it once deploy everywhere philosophy.
Pogg
@fogkio
Aug 22 2016 02:47
now have a warning
Egoscio
@Egoscio
Aug 22 2016 02:47
@fogkio Remove the quotes for return myObj["checkProg"]
checkProg is a variable
You're querying the myObj dictionary based on the string value of the variable checkProp
Pogg
@fogkio
Aug 22 2016 02:48
kayy
let me check
Angel J Piscola
@Redmega
Aug 22 2016 02:48
@Egoscio Not sure I'm following. Its ugly because you only write it once?
Egoscio
@Egoscio
Aug 22 2016 02:48
Please understand the issue, it's the whole reason you should be taking this course ;)
Cole Logan
@CocaWinkle
Aug 22 2016 02:49
``
Angel J Piscola
@Redmega
Aug 22 2016 02:49
It does have style.ios.css and style.andorid.css for you to customize
Pogg
@fogkio
Aug 22 2016 02:49
got it @Egoscio thanks
CamperBot
@camperbot
Aug 22 2016 02:49
fogkio sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:cookie: 20 | @egoscio |http://www.freecodecamp.com/egoscio
Angel J Piscola
@Redmega
Aug 22 2016 02:49
The whole point of Nativescript is the "write once, run everywhere" lol
deploy*
Egoscio
@Egoscio
Aug 22 2016 02:49
@Redmega From my perspective, each operating system should have its own aesthetic features. Relying on nativescript for it to adopt the OS's design is not my thing.
That's entirely my opinion. You can go about without your fancy frameworks ;) I prefer the architecture apple's developing.
Angel J Piscola
@Redmega
Aug 22 2016 02:50
Fair enough. I don't see how there's a difference, Nativescript adapts to the OS's UI using the OS's own native elements, but to each his own
Egoscio
@Egoscio
Aug 22 2016 02:51
Nativescript is not supporting enough of Apple's UI API.
They're only implementing the bare basics.
Angel J Piscola
@Redmega
Aug 22 2016 02:51
Ah. That I wouldn't know much about, I've only tested it on Android
I don't own any apple products, so :sheep:
Egoscio
@Egoscio
Aug 22 2016 02:52
UIKit is a very rich API which has been battle tested specifically for the iOS platform. Having a suit tailor made is preferable depending for some ^^
Angel J Piscola
@Redmega
Aug 22 2016 02:52
Getting late, I'm off. Night y'all
Egoscio
@Egoscio
Aug 22 2016 02:52
nighty night
Pogg
@fogkio
Aug 22 2016 03:20
@Egoscio alooo
anybody here ?
Egoscio
@Egoscio
Aug 22 2016 03:23
sup
Ken Haduch
@khaduch
Aug 22 2016 03:26
@fogkio - a couple people lurking around - what might you need help with?
Pogg
@fogkio
Aug 22 2016 03:27
i stuck again
JSON
Egoscio
@Egoscio
Aug 22 2016 03:27
fam ask away
Pogg
@fogkio
Aug 22 2016 03:27
i dont know about question freecodecamp give
solve name "Manipulating Complex Objects"
:(
Egoscio
@Egoscio
Aug 22 2016 03:28
what's the link to the challenge?
Pogg
@fogkio
Aug 22 2016 03:30
link?
link URL in a browser? @Egoscio
Egoscio
@Egoscio
Aug 22 2016 03:31
yes
here :clap:
Ken Haduch
@khaduch
Aug 22 2016 03:34
@fogkio - the initial state of the code is that there is an array that contains an object that represents a musical recording (a "record album".) They are asking you to add a second record album (a new object) to the array, and make a special note: You will need to place a comma after every object in the array, unless it is the last object in the array. So make sure to put a comma between each object. In other words - you have this: myMusic = [ { object1 } ];, and you want to make this: myMusic = [ { object1 }, { object2 } ]; by adding the second object.
Pogg
@fogkio
Aug 22 2016 03:37
ohhh
Don't really understand the question.
I've inputted: var processed = 2;
Pogg
@fogkio
Aug 22 2016 03:37
let me try
daniel2morgan
@daniel2morgan
Aug 22 2016 03:38
which gets a green tick but when I state var processed = processArg I get an error
I'm missing something fundamental here but can't seem to work it out.
Ken Haduch
@khaduch
Aug 22 2016 03:39
@daniel2morgan - in the example, they show the action of calling the function and storing the value in a variable : changed = change(10); - so you need to do the same thing in the code that you are adding - calling the function means to put the function name, followed by ( ) parentheses with the argument between them - they say to put a specific number as the argument.
Subramanya Chakravarthy
@chakrihacker
Aug 22 2016 03:40
@daniel2morgan you have to use processArg function with value 7
and assign it to processed
daniel2morgan
@daniel2morgan
Aug 22 2016 03:40
ahhh ok let me try @khaduch
Subramanya Chakravarthy
@chakrihacker
Aug 22 2016 03:40
then console.log the processed value
daniel2morgan
@daniel2morgan
Aug 22 2016 03:43
ok I'm a bit lost still. let me try an write this down.
processed = processArg(7);
got it :)
is this correct? It's given a pass.
Pogg
@fogkio
Aug 22 2016 03:46
@khaduch i'm almost done

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  },
  // Add record here
  {
    "artist":"Phong",
    "title":"Wings Man",
    "release_year":1968,
    "format": [
      "a",
      "b",
      "c",
      "d" ],
  }
];
can y give me a suggest ?
why my "format" number 2
not a array
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:48
trailing comma
Egoscio
@Egoscio
Aug 22 2016 03:50
That's weird. Javascript allows trailing commas.
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:51
just because you can get away with being lazy doesn't mean you should make it a goal
Ken Haduch
@khaduch
Aug 22 2016 03:51
@fogkio - also try the key "formats" with an s instead of "format"? They do not take the trailing comma, from my recollection - but maybe it's just that they don't allow it in the tests?
Egoscio
@Egoscio
Aug 22 2016 03:51
@TheJaredWilcurt That's not being lazy, in fact, it's recommend in the javascript style guide by Airbnb
Pogg
@fogkio
Aug 22 2016 03:52
i got it's :)) then now i done @khaduch thanks
CamperBot
@camperbot
Aug 22 2016 03:52
fogkio sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1567 | @khaduch |http://www.freecodecamp.com/khaduch
Egoscio
@Egoscio
Aug 22 2016 03:52
The more you know :)
Ken Haduch
@khaduch
Aug 22 2016 03:52
@fogkio - you have to watch for the spelling of the variables and other code items they are looking for - no allowances for typos! And you're welcome...
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:53
The reasoning behind promoting this anti-pattern is because of git diffs and transpilers
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:53
yeah
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:53
are you using git with your FCC based challenge?
are you using babel?
Egoscio
@Egoscio
Aug 22 2016 03:54
I don't do FFC at all. I use git and babel, yes.
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:54
FFC = FreeFoodCamp
Egoscio
@Egoscio
Aug 22 2016 03:54
I know.
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:54
FCC = FreeCodeCamp
;P
Ken Haduch
@khaduch
Aug 22 2016 03:54
@daniel2morgan - that looks like what they want - invoke the function processArg with the argument 7 - would be processArg( 7 ); and assign it to the variable.
Egoscio
@Egoscio
Aug 22 2016 03:54
wait lol
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:54
but the person posting code was point to FCC's flawed JS parser
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:55
well, it's simply regex
no JS parsers ;P
Egoscio
@Egoscio
Aug 22 2016 03:55
The person was talking about JSON, I made a comment about javascript and you called it lazy. I justified the reason for my comment.
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:55
Regex still parses text, that's how Regular Expressions work
khaduch @khaduch - leaving for the night... good luck and happy coding!
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:56
yeah! a text parser ;)
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:56
Your code should be cross-browser compatible. Trailing commas are not. If you are using a transpiler or other automated tool to remove them prior to making them browser safe, then you are adding in an extra step to fix your bad code rather than just writing it correctly to begin with. You should write for your end user, not for your tools.
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:57
Chrome does support trailing commas though ;)
The Jared Wilcurt
@TheJaredWilcurt
Aug 22 2016 03:58
So you're just here to troll and suggest poor coding practices. Good job. I'm going to bed and unsubbing from the room
CamperBot
@camperbot
Aug 22 2016 03:58
:trollface: troll problems? notify admins here
Abhisek Pattnaik
@abhisekp
Aug 22 2016 03:59
@Egoscio woah! weird. ..
Egoscio
@Egoscio
Aug 22 2016 03:59
Jared, your idea of wrong and right is relative to your beliefs. I don't see this aggressiveness to be quite necessary
Norvin Burrus
@ndburrus
Aug 22 2016 04:03
@michaeltnoronha perhaps, true... :)
Abhisek Pattnaik
@abhisekp
Aug 22 2016 04:03

Actually, I agree with both @Egoscio @TheJaredWilcurt
@Egoscio you say to use it because you use tools
@TheJaredWilcurt is focusing more on the current issue with the camper using trailing commas which not every browser supports and also the reason of not passing the tests in http://freecodecamp.com/

So i guess both are correct :D

Abhisek Pattnaik
@abhisekp
Aug 22 2016 04:11
8 mins of silence :exclamation: :no_mouth:
Norvin Burrus
@ndburrus
Aug 22 2016 04:16
@pchelpme :sparkles:
ok, we need to take the given string, here:
"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine" (ignore the spacing) and carefully replace the appropriate text (bold words) with the escape coding (use the Code/Output chart)...
r2d2
@UsamaHameed
Aug 22 2016 04:17
What has transpired here? @abhisekp
Abhisek Pattnaik
@abhisekp
Aug 22 2016 04:17
@UsamaHameed transpiled?
r2d2
@UsamaHameed
Aug 22 2016 04:18
What happened here?
I think I missed some action
r2d2
@UsamaHameed
Aug 22 2016 04:46
Silence :exclamation:
LaToya
@llrich30032
Aug 22 2016 04:59
Hi! I'm having some trouble with this question:
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

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

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

Pogg
@fogkio
Aug 22 2016 05:00
@llrich30032 use ``` to display code
LaToya
@llrich30032
Aug 22 2016 05:00
Can someone walk me through the logic?
'''
CamperBot
@camperbot
Aug 22 2016 05:00
:bulb: to format code use backticks! ``` more info
Manish Giri
@Manish-Giri
Aug 22 2016 05:02
@llrich30032 yeah
Pogg
@fogkio
Aug 22 2016 05:02
@llrich30032 the logic in here is "you push a varriable to array then you must pop another varri in array out in the same function"
Manish Giri
@Manish-Giri
Aug 22 2016 05:02

@llrich30032 the crux of the challenge is

dd the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

Dan Couper
@DanCouper
Aug 22 2016 05:02
Whoah that guy was super touchy about trailing commas
Norvin Burrus
@ndburrus
Aug 22 2016 05:03
@llrich30032 this may be helpful: :sparkles:
LaToya
@llrich30032
Aug 22 2016 05:05
Thank you! I attempted using .push() and .shift() but I think I did something wrong
Markus Kiili
@Masd925
Aug 22 2016 05:05
@DanCouper Are there really some browser compatibility issues with trailing commas in array literals? I thought it was standard thing in ES5 to allow them.
Manish Giri
@Manish-Giri
Aug 22 2016 05:05
@llrich30032
  1. first task is to push the variable called item to the end of the array arr - use .push() for this
  2. second task requires you to remove the first item from the array
  3. finally you need to return the element removed in step 2 , so you can combine 2 and 3 to return arr.shift();
LaToya
@llrich30032
Aug 22 2016 05:06
Thank you @Manish-Giri . I will attempt that now
CamperBot
@camperbot
Aug 22 2016 05:06
llrich30032 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 1652 | @manish-giri |http://www.freecodecamp.com/manish-giri
Dan Couper
@DanCouper
Aug 22 2016 05:11
@Masd925 IE 11 blows up, but it does actually give a useful error meggage as far as I can remember. First Edge might do as well. Otherwise, p good support, but officially ES6, not 5. However, there seems to be a consensus forming that trailing commas == good and should always be used where possible as they make thing very slightly easier and less error-prone for zero overhead, so :shrug:
Markus Kiili
@Masd925
Aug 22 2016 05:13
@DanCouper ok, thanks.
CamperBot
@camperbot
Aug 22 2016 05:13
masd925 sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 190 | @dancouper |http://www.freecodecamp.com/dancouper
kennyq94
@kennyq94
Aug 22 2016 05:16
hi guys i really need help I can't get the temperature from the data, what is wrong with my code? I tried so many things x.x
http://codepen.io/kennyqsoftware/pen/yJXwyb?editors=1010
Manish Giri
@Manish-Giri
Aug 22 2016 05:17
@IlhamiD welcome! lemme know how it goes..
kennyq94
@kennyq94
Aug 22 2016 05:33
I just want to take a moment to say I love everyone in this gitter community you guys are basically my peer programmers, I feel no pressure to know everything when I am working with this community, you guys are the best. !!!
Egoscio
@Egoscio
Aug 22 2016 05:53
@kennyq94 What seems to be the problem?
Also, does the official challenge now require you to use crossorigin.me? lol
Dozens of people came here with that issue and that was my solution to it. guess it got officialized
张登泽
@dictatorone
Aug 22 2016 05:54

function spinalCase(str) {
if(str === "thisIsSpinalTap"){
return "this-is-spinal-tap";

}
var re = /_/gi;
var myReg1 = str.replace(re,' ');

myReg1 = myReg1.toLowerCase();
myReg1 = myReg1.split(' ');
return myReg1.join('-');
}

spinalCase('The_Andy_Griffith_S');
Do we have a better solution?

Spinal Tap Case
Egoscio
@Egoscio
Aug 22 2016 05:57
@dictatorone Why do you need the initial if statement? It seems a little too specific for a function.
your regular expression should also handle spaces
张登泽
@dictatorone
Aug 22 2016 05:59
yes,but I don't know how to do except that
but how?
Egoscio
@Egoscio
Aug 22 2016 06:00
You can add another separator case to the regex by separating each case with a vertical bar: |
张登泽
@dictatorone
Aug 22 2016 06:01
sorry,can you show me?I sm a little confused
am
Egoscio
@Egoscio
Aug 22 2016 06:02
var regex = /_|\s/
it matches with both underscore and space
Also, this is a really useful webapp for building regular expressions. It also tells you what each part does.
张登泽
@dictatorone
Aug 22 2016 06:04
seems doesn't work
Pranay Kumar
@pranaykumar389
Aug 22 2016 06:04
Hi Everybody!
I'm Pranay Kumar. I done with My 2nd Project build a personal portfolio please have a look over here https://rudrapranaykumar.github.io/MyPortfolio/
Please comment good and bad and mostly suggest me for more improvement.
Thank you
Egoscio
@Egoscio
Aug 22 2016 06:05
@dictatorone That's the first part to making it work. The tests execute with both spaces and underscores.
ZZPot
@ZZPot
Aug 22 2016 06:05
how can I get caller element's id in function?
$(".calc_button").on("click", function()
{
id_action_map.this.id; // like this
});
Egoscio
@Egoscio
Aug 22 2016 06:06
@ZZPot $(this).attr('id')
wait
What is id_action_map
Mark Todd
@Knochenmark
Aug 22 2016 06:06
@rudrapranaykumar looks really good so far, but you should try to fill some more whitespace. For example the whitespace between the picture and your "About Me" part. Your Skills are also quite lost with that much space around them.
ZZPot
@ZZPot
Aug 22 2016 06:06
it's a id-to-action map
get id - make an action
add number or operation
张登泽
@dictatorone
Aug 22 2016 06:07
@Egoscio ,ok,thanks
Egoscio
@Egoscio
Aug 22 2016 06:07
In that case, you need to use bracket notation
id_action_map[$(this).attr('id')]
Also, please consider using camel case :)
ZZPot
@ZZPot
Aug 22 2016 06:09
why using camelCase?
it's global variable
not a function
Chris Cullen
@123xylem
Aug 22 2016 06:09
http://codepen.io/123xylem/pen/JKqYZY?editors=1010
Hi could you help with my .click function.. WHy its not showing text in the div on click?
ZZPot
@ZZPot
Aug 22 2016 06:10
also, is it able to use pointer to the function in object? Like var obj={asd:alert};?
Could you elaborate what you mean by that?
ZZPot
@ZZPot
Aug 22 2016 06:12
to call a function from object by property
Egoscio
@Egoscio
Aug 22 2016 06:12
Yeah you can do that.
ZZPot
@ZZPot
Aug 22 2016 06:12
like obj.asd("alert msg");
but definiton of the function was earlier
Egoscio
@Egoscio
Aug 22 2016 06:13
var myFunction = 'log'
console[myFunction]('Hello world!')
Not the best example, but I hope you get the idea.
ZZPot
@ZZPot
Aug 22 2016 06:14
oh, thanks
@Egoscio thnx, get a cookie
CamperBot
@camperbot
Aug 22 2016 06:14
zzpot sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:cookie: 21 | @egoscio |http://www.freecodecamp.com/egoscio
Egoscio
@Egoscio
Aug 22 2016 06:14
@123xylem You're supposed to use $(this) if you want to use the element that triggered the event
Thanks for the cookie :P
Pranay Kumar
@pranaykumar389
Aug 22 2016 06:15
@Knochenmark Thank you! Yeah I sure i will try to fill them.
CamperBot
@camperbot
Aug 22 2016 06:15
rudrapranaykumar sends brownie points to @knochenmark :sparkles: :thumbsup: :sparkles:
:cookie: 439 | @knochenmark |http://www.freecodecamp.com/knochenmark
Egoscio
@Egoscio
Aug 22 2016 06:15
@123xylem Example:
var userX=1;
$("#a").click(function () {
  if (userX>0){
    $(this).text("X");
  }
});
Chris Cullen
@123xylem
Aug 22 2016 06:15
var userX;
var userO;

$("#box").click(function ()
               {
  if (userX>0){   
    $("#box").text("X");        //Can i say box.thisbox.text();  ??????

  }
WRN1111
@WRN1111
Aug 22 2016 06:16
function palindrome(str) {
var tmpStr = str.replace(/[[]\s\?.!-;,:\'\"]+/g,'').toLowerCase().split('');
var tmp = tmpStr.length;
for (i=0; i<tmp/2; i++) {
if(tmpStr[i] === tmpStr[tmp-1-i]) {
return true;
}else {
return false;
}
}
}
I don't know what the problems are about palindromes
Egoscio
@Egoscio
Aug 22 2016 06:16
No, you have to do $(this) still
$(this).text('X')
Coryphaeus
@cvdeveloper13
Aug 22 2016 06:17
@WRN1111 Please format your code
Mark Todd
@Knochenmark
Aug 22 2016 06:18
@rudrapranaykumar what did you actually use for your portfolio? looks quite template like
Egoscio
@Egoscio
Aug 22 2016 06:18
@123xylem Another option is to use event.target if you put an argument in your event callback. https://api.jquery.com/event.target/
Chris Cullen
@123xylem
Aug 22 2016 06:18
var userX=1;
var userO=0;

$("#box").click(function ()
               {
  if (userX>0){
    $("#this").text("X");

  }
  else if (userY>0){
    $("#this").text("O");

  }
});
Egoscio
@Egoscio
Aug 22 2016 06:19
No, this is a variable.
Well, it's defined in the context of functions
Chris Cullen
@123xylem
Aug 22 2016 06:20
@Egoscio Its just that I hvave 9 different boxes so if I could click A box and have it appear in whichever box was clicked rather than 9 different functions
Egoscio
@Egoscio
Aug 22 2016 06:20
Providing the string value won't work. $(this).text('O') is how you're supposed to do it
Chris Cullen
@123xylem
Aug 22 2016 06:20
if you know what i mean
Egoscio
@Egoscio
Aug 22 2016 06:20
$(this) dynamically references to the box that was clicked.
Pranay Kumar
@pranaykumar389
Aug 22 2016 06:20
@Knochenmark Oh..I just used Bootstrap only...Do I need to change it ?
Chris Cullen
@123xylem
Aug 22 2016 06:21
var userX=1;
var userO=0;

$("#box").click(function ()
               {
  if (userX>0){
    $(this).text("X");

  }
  else if (userY>0){
    $(this).text("O");

  }
});
Egoscio
@Egoscio
Aug 22 2016 06:21
yea that's how you should do it.
Mark Todd
@Knochenmark
Aug 22 2016 06:21
@rudrapranaykumar no, just curious. i think you can use whatever you prefer
WRN1111
@WRN1111
Aug 22 2016 06:29
function palindrome(str) {
  var tmpStr = str.replace(/[\[\]\s\?\.!-;,:\'\"]+/g,'').toLowerCase().split('');
  var tmp = tmpStr.length;
  for (i=0; i<tmp/2; i++) {
    if(tmpStr[i] === tmpStr[tmp-1-i]) {
      return true;
    }else {
      return false;
    }     
 }
}
I don't know what the problems are about palindromes
Coryphaeus
@cvdeveloper13
Aug 22 2016 06:30
What kind of error you got?
@WRN1111
@WRN1111 first - you need to return after the loop ends
@WRN1111 Because now, you'll show the result after first check
WRN1111
@WRN1111
Aug 22 2016 06:33

can't judge

palindrome("almostomla")

and

palindrome("1 eye for of 1 eye.")
Chris Cullen
@123xylem
Aug 22 2016 06:33
http://codepen.io/123xylem/pen/JKqYZY
Why does my input click move the boxes around?
Coryphaeus
@cvdeveloper13
Aug 22 2016 06:33
just try to remove first return true and then check the result
@WRN1111 Now you're checking just first value
WRN1111
@WRN1111
Aug 22 2016 06:34
OK
Markus Kiili
@Masd925
Aug 22 2016 06:35
@WRN1111 You should check if the characters are different and return false in that case. Then figure out where to return true.
@WRN1111 There is also problem with the regexp.
Markus Kiili
@Masd925
Aug 22 2016 06:41
@WRN1111 You are removing numbers although you should not and you are not removing underscore.
Ryan Apolinar
@ryanapolinar
Aug 22 2016 06:45
Having an issue with getJSON and API to access IP address/geolocation without prompting the user, I made sure that both Codepen and the API are using https. Here's the link to the CodePen
Egoscio
@Egoscio
Aug 22 2016 06:47
"data: [object Object]"
Is that your issue?
I'm not getting any alerts
Ryan Apolinar
@ryanapolinar
Aug 22 2016 06:48
Yes, [object Object] should be the JSON data
Egoscio
@Egoscio
Aug 22 2016 06:49
Well, it's appearing on my page without prompting me. What exactly is the issue though.
That it's showing as [object Object]?
If you want it to show as text do $("#loc").html("data: " + JSON.stringify(data))
Ryan Apolinar
@ryanapolinar
Aug 22 2016 06:51
@Egoscio thank you very much!
CamperBot
@camperbot
Aug 22 2016 06:51
ryanapolinar sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:cookie: 22 | @egoscio |http://www.freecodecamp.com/egoscio
Ryan Apolinar
@ryanapolinar
Aug 22 2016 06:52
@Egoscio Aw geez I just remembered it's entirely unnecessary to even print it out to the page but i'm grateful you helped me figure it out, I've been stuck on that for a while lol
Egoscio
@Egoscio
Aug 22 2016 06:53
:)
WRN1111
@WRN1111
Aug 22 2016 06:53
@Masd925 yeap,the best regexp should be /[\W_]/g
Pogg
@fogkio
Aug 22 2016 06:54
anyone
hiiii
Egoscio
@Egoscio
Aug 22 2016 06:54
heya
Pogg
@fogkio
Aug 22 2016 06:55
i need help :(
again :(
Egoscio
@Egoscio
Aug 22 2016 06:55
its aite bro
Chanjung Kim
@chanjungkim
Aug 22 2016 06:55
Hello
Pogg
@fogkio
Aug 22 2016 06:55
link bro?
Egoscio
@Egoscio
Aug 22 2016 06:56
just the name would work and the code you already have
Pogg
@fogkio
Aug 22 2016 06:56
do y need that :sparkles:
Record Collection
i can understand question this solve
cant
Markus Kiili
@Masd925
Aug 22 2016 06:59
@fogkio You need to test parameters value and prop, and access collection on if blocks. Tracks property needs some special care.
Egoscio
@Egoscio
Aug 22 2016 07:01
@Masd925 Someone else asked me this question and I believe I partially solved it by suggesting tracks has to be an array before running the push method. Correct?
Markus Kiili
@Masd925
Aug 22 2016 07:01
@Egoscio Yes, the property existence should be checked with .hasOwnProperty() before pushing.
swapnildaddikar
@swapnildaddikar
Aug 22 2016 07:01
can someone help me with search and replace chalenege of javascriopt
?
Pogg
@fogkio
Aug 22 2016 07:02
ohhhhh use that? @Masd925
swapnildaddikar
@swapnildaddikar
Aug 22 2016 07:03
i need help with 1 case
Markus Kiili
@Masd925
Aug 22 2016 07:04
@fogkio Yes, when prop is tracks and value non-empty, you need to check if the tracks property exist on the record in collection. Then either .push(value) if it exists or assign [value] if it doesn't.
mamun
@fsdmamun
Aug 22 2016 07:04

pls solve this: function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

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

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

Pogg
@fogkio
Aug 22 2016 07:05
@Masd925 go go i try this
w8
swapnildaddikar
@swapnildaddikar
Aug 22 2016 07:06
function myReplace(str, before, after) {
  var array= str.split(" ");
  var temp;
  for(var x=0;x<array.length;x++)
    {
      if(array[x]==before)
        {
          array[x]=after;
        }
    }
  return array.join(" ");
}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
guys how can i keep the lettercase intact
Pogg
@fogkio
Aug 22 2016 07:06
without check the id?
swapnildaddikar
@swapnildaddikar
Aug 22 2016 07:07
someone pls help
majaprocess
@Majaprocess
Aug 22 2016 07:07
@mamunb2b fahrenheit = (celsius * 9/5) + 32;
// Only change code above this line
return fahrenheit;
Pogg
@fogkio
Aug 22 2016 07:07
@Masd925
Markus Kiili
@Masd925
Aug 22 2016 07:08
@fogkio You don't need to check the id. You only use it to access the record with given id: collection[id]
Rony Vidaur
@RonyVidaur
Aug 22 2016 07:10
$("#getter").on("click", function(){
  var api ="http://quotes.rest/qod.json";
$.getJSON(api, function(obj){
  $.each(obj, function(key , value){
    $(".quote").html("<p>"+value.quote+"</p>");

  })
});  

});
hey guys I just started building the random quote machine challenge
I am kinda following the example on the JQuery website
but I'm not getting the result that I need
I just get the actual object like this [Object]
but I can't access the inner properties of that object
any advice?
Markus Kiili
@Masd925
Aug 22 2016 07:18
@RonyVidaur Can you post the JSON that is received from that call?
Rony Vidaur
@RonyVidaur
Aug 22 2016 07:19
{
    "success": {
        "total": 1
    },
    "contents": {
        "quotes": [
            {
                "quote": "I think it is often easier to make progress on mega-ambitious dreams. Since no one else is crazy enough to do it, you have little competition. In fact, there are so few people this crazy that I feel like I know them all by first name.",
                "length": "234",
                "author": "Larry Page",
                "tags": [
                    "ambitious",
                    "inspire"
                ],
                "category": "inspire",
                "date": "2016-08-22",
                "title": "Inspiring Quote of the day",
                "background": "https://theysaidso.com/img/bgs/man_on_the_mountain.jpg",
                "id": "o_Jy9hvcLh95RwZ3m54MHgeF"
            }
        ]
    }
}
@Masd925
Vladimir
@OXJIAMOH
Aug 22 2016 07:19
@RonyVidaur i think you dont need $.each() function to access your json data - i mean you got only 1 quote
Markus Kiili
@Masd925
Aug 22 2016 07:20
@RonyVidaur Should you first access the quotes array and then iterate it?
Rony Vidaur
@RonyVidaur
Aug 22 2016 07:20
@OXJIAMOH yeah right now im trying with that one that has just one, you're right
@Masd925 Should I? sorry man I'm completly lost to be honest
Markus Kiili
@Masd925
Aug 22 2016 07:22
@RonyVidaur Looks like obj.contents.quotes is the array of quotes (objects). You could iterate it to get the individual quotes.
Pogg
@fogkio
Aug 22 2016 07:23
@Masd925
am i wrong?

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

// Only change code below this line
function updateRecords(id, prop, value) {
  if(collection[id].hasOwnProperty(prop)){
    collection[id].push(prop.value);
  }
  else{
    if(value===""){
      collection[id].remove(prop);
    }
  }
  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Rony Vidaur
@RonyVidaur
Aug 22 2016 07:23
$("#getter").on("click", function(){
  var api ="http://quotes.rest/qod.json";
$.getJSON(api, function(obj){
  $.each(obj.contents.quotes, function(key , value){
    $(".quote").html("<p>"+value.quote+"</p>");

  })
});  

});
it works now!
Markus Kiili
@Masd925
Aug 22 2016 07:23
@fogkio Only make the property existence test if prop is tracks and value non-empty.
Pogg
@fogkio
Aug 22 2016 07:24
ahhh
just
Rony Vidaur
@RonyVidaur
Aug 22 2016 07:24
@Masd925 thanks, I didn't quite understand and I was trying to access that info from value
CamperBot
@camperbot
Aug 22 2016 07:24
ronyvidaur sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2327 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Aug 22 2016 07:24
@fogkio You should use delete to remove a property.
Pogg
@fogkio
Aug 22 2016 07:24
just push when prop is "tracks"?
Markus Kiili
@Masd925
Aug 22 2016 07:25
@fogkio If prop is not tracks, you just assign the value. If it is tracks you push the value (provided that the tracks array exists).
Egoscio
@Egoscio
Aug 22 2016 07:27
What's FCC's way of checking if a variable is an array?
When I'm lazy I just check if typeof is object and length has a value, but I'm pretty sure there's better ways. On stackoverflow I've read you can do someVar.constructor === Array
suxiesumiao
@suxiesumiao
Aug 22 2016 07:29
the question which title is " Escape Sequences in Strings " in js , how does id worked?
suxiesumiao
@suxiesumiao
Aug 22 2016 07:29
My English is poor ,plese HELP
Egoscio
@Egoscio
Aug 22 2016 07:30
@Masd925 Dang, how did I not remember that.
@Masd925 Thanks!
CamperBot
@camperbot
Aug 22 2016 07:30
egoscio sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2328 | @masd925 |http://www.freecodecamp.com/masd925
Pogg
@fogkio
Aug 22 2016 07:31
its hard =))))))))
@Masd925
Markus Kiili
@Masd925
Aug 22 2016 07:31
@fogkio Yes, it is fun ;)
Pogg
@fogkio
Aug 22 2016 07:33
=))) i still stuck in my mind =))
Paul de Barthez
@uxpaul
Aug 22 2016 07:39
Hello guys,
I'm stuck here ... Total should = 20
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
for (var total = 0; total<myArr.length; total++) {
  console.log(myArr[total]);
}
Chris Cullen
@123xylem
Aug 22 2016 07:39
http://codepen.io/123xylem/pen/JKqYZY
how can i make my switch use my Divs ID Value?
Markus Kiili
@Masd925
Aug 22 2016 07:43
@uxpaul You should have a variable total that stores the cumulative value and then another variable for the looped index.
Paul de Barthez
@uxpaul
Aug 22 2016 07:46

Hello please help :

@Masd925 Thanks man ;)

Norvin Burrus
@ndburrus
Aug 22 2016 07:49
@suxiesumiao these may be helpful: :sparkles:
DarkManeiac
@DarkManeiac
Aug 22 2016 07:50
hi guys!
i need some help at Using Objects for Lookups
Norvin Burrus
@ndburrus
Aug 22 2016 07:50
@suxiesumiao ok, we need to take the given string, here:
"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine" (ignore the spacing) and carefully replace the appropriate text (bold words) with the escape coding (use the Code/Output chart)...
@DarkManeiac can you post?
''' @DarkManeiac
CamperBot
@camperbot
Aug 22 2016 07:51
:bulb: to format code use backticks! ``` more info
DarkManeiac
@DarkManeiac
Aug 22 2016 07:51

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

// Only change code below this line
switch(val) {
case "alpha":
result = "Adams";
break;
case "bravo":
result = "Boston";
break;
case "charlie":
result = "Chicago";
break;
case "delta":
result = "Denver";
break;
case "echo":
result = "Easy";
break;
case "foxtrot":
result = "Frank";
}

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

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

i must convert the switch statement into a lookup table
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:52
@ndburrus how are you, could you help me with a Javascript challenge please?
Norvin Burrus
@ndburrus
Aug 22 2016 07:52
@DarkManeiac :sparkles:
  • we need to use a lookup object, not a swicth statement - reference the example code in the pink text box
@juanakin180 which lesson name?
DarkManeiac
@DarkManeiac
Aug 22 2016 07:52
yea, i know
manusia123
@manusia123
Aug 22 2016 07:53
did anybody here finish the basic front end challange in one go ?
DarkManeiac
@DarkManeiac
Aug 22 2016 07:53
i tryed but, it didnt work
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:53
Convert Celsius to Fahrenheit @ndburrus
ArtemOnischenko
@ArtemOnischenko
Aug 22 2016 07:53
@123xylem ```
Norvin Burrus
@ndburrus
Aug 22 2016 07:53
@juanakin180 The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
we can rewrite the equation/formula to:
Fahrenheit = Celsius(9/5), plus + 32.
which is F = C(9/5) + 32.
alright, so we need to convert this formula to code!
DarkManeiac
@DarkManeiac
Aug 22 2016 07:53
fahrenheit = celsius * 9/5 + 32 @juanakin180
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:53
how do I execute all different cases at the same time?
ArtemOnischenko
@ArtemOnischenko
Aug 22 2016 07:54
@123xylem
$(".box").attr('id')
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:54
@ndburrus
Norvin Burrus
@ndburrus
Aug 22 2016 07:54

@DarkManeiac model the criteria as shown in the table to the left, here:

var alpha = {
  1:"Z",
  2:"Y",
  3:"X",
  4:"W",
  ...
  24:"C",
  25:"B",
  26:"A"
};

the number values map to alpha-foxtrot, while the letter values map to Adams-Frank

next, review how these desired values are accessed (from the object), here:

alpha[2]; // "Y"
alpha[24]; // "C"
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:55
I did it @ndburrus
I was missing Celsius
in the operation
suxiesumiao
@suxiesumiao
Aug 22 2016 07:56
@ndburrus Thank you,I have worked id out
CamperBot
@camperbot
Aug 22 2016 07:56
suxiesumiao sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1769 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Aug 22 2016 07:56
@juanakin180 :+1:
Juan Sebastian Ortega
@juanakin180
Aug 22 2016 07:56
instead, i was putting a numer, thnak you @ndburrus
number
Norvin Burrus
@ndburrus
Aug 22 2016 07:57
@suxiesumiao @juanakin180 you're welcome! super! nicely done! :palm_tree:
@DarkManeiac how are we doing?
DarkManeiac
@DarkManeiac
Aug 22 2016 08:00
i am trying man

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

// Only change code below this line

var lookup = {"alpha":"Adams"};

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

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

RajDiptanshu
@RajDiptanshu
Aug 22 2016 08:03
Some1 help me solving this challenge
maxnation
@maxnation
Aug 22 2016 08:03
why the output is 10?

function findLongestWord(str) {
var greatCount=0;
var count=0;
for(i=0;i<=str.length-1;i++){ // проходим по всему слову

if(str[i] !== " ") {count++;}

else{
if(count>greatCount){
greatCount=count;
count=0;
}

count=0; //add
}

}
return greatCount;
}

findLongestWord("What if we try a super-long word such as otorhinolaryngology");

it have to be 19, but I don't know how to check the last word after the last whitespace
I've tried to check if the i is in the last position and after that stop the loop and check the count, but unsuccessfully
DarkManeiac
@DarkManeiac
Aug 22 2016 08:06

@ndburrus
i got this:
function phoneticLookup(val) {
var result = "";

// Only change code below this line

var lookup = {"alpha":"Adams"};

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

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

Norvin Burrus
@ndburrus
Aug 22 2016 08:08
@DarkManeiac :sparkles:
  • ok, complete the object table - for all values
Ryan Apolinar
@ryanapolinar
Aug 22 2016 08:09
Trying to use data from one getJSON to implement into another URL for another getJSON, but global variables aren't working. Here is my Codepen
DarkManeiac
@DarkManeiac
Aug 22 2016 08:10

@ndburrus
// 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("alpha");

Pogg
@fogkio
Aug 22 2016 08:11
@Masd925 hellp?
hellooo
DarkManeiac
@DarkManeiac
Aug 22 2016 08:11
hi @fogkio :D
swapnildaddikar
@swapnildaddikar
Aug 22 2016 08:11
guys please help me with search and replace challange im unable to preserve the upper and lowercases ... how to do that
function myReplace(str, before, after) {
  var array= str.split(" ");
  var temp;
  for(var x=0;x<array.length;x++)
    {
      if(array[x]==before)
        {
         array[x]=after;
    }

}
    return array.join(" ");
}

myReplace("Let us go to the store", "store", "mall");
this is my code
what do i have to add
Vladimir
@OXJIAMOH
Aug 22 2016 08:14
@swapnildaddikar you got a typo - you need to close if () statement with }
swapnildaddikar
@swapnildaddikar
Aug 22 2016 08:14
ive closed it
Ryan Apolinar
@ryanapolinar
Aug 22 2016 08:14
@swapnildaddikar you want to check for the case, so:
if (before[0] == before[0].toUpperCase()){
   array[x] = after[0].toUpperCase() + after.substring(1,after.length);
}
swapnildaddikar
@swapnildaddikar
Aug 22 2016 08:15
s
case
Vladimir
@OXJIAMOH
Aug 22 2016 08:15
@swapnildaddikar oh realy sry then
Ryan Apolinar
@ryanapolinar
Aug 22 2016 08:16
@swapnildaddikar and otherwise, just do array[x]=after; like you have right there
Norvin Burrus
@ndburrus
Aug 22 2016 08:21

@DarkManeiac :sparkles:

  • need , after "foxtrot":"Frank"
  • need to handle the return/result

notice how a desired value is extracted from the object, here:

alpha[2]; // "Y"
alpha[24]; // "C"

@RajDiptanshu this may be helpful: :sparkles:

we need to use two methods that will help meet the 2 requirements:

  • Add the number to the end of the array, &
  • remove the first element of array
afani martin
@whiz25
Aug 22 2016 08:24

can someone help me put this right. function palindrome(str) {
// Good luck!
if(str.replace(/[^A-Za-z0-9]/g,'').split(" ").join(" ").toLowerCase() === str)
return true;
}

palindrome("eye");

i still get errors
palindromes challenge
Tracey Bushman
@tbushman
Aug 22 2016 08:28
Looks like you're missing the .reverse() step... @whiz25
Pogg
@fogkio
Aug 22 2016 08:28
i need a big help :(
Ryan Apolinar
@ryanapolinar
Aug 22 2016 08:30
Having trouble when I use two getJSON calls. Trying to use some information from the first to build the URL of the second, but it fails to do so. Here is the Codepen
Nevermind, added 'callback=?' but I still had to refresh the page
Ari Winokur
@ariwinokur
Aug 22 2016 08:35
Working through the challenge, "Using Objects for Lookups"
Tracey Bushman
@tbushman
Aug 22 2016 08:35
... also @whiz25 , someone shared this with me earlier, https://regex101.com/, for testing regexps, and I found it helpful on that challenge
Ari Winokur
@ariwinokur
Aug 22 2016 08:35
not sure what I am doing wrong
Egoscio
@Egoscio
Aug 22 2016 08:36
I personally always use http://regexr.com/
Ari Winokur
@ariwinokur
Aug 22 2016 08:36
everything seems to be right until after the lookup table I put this line: lookup[val];
Abhisek Pattnaik
@abhisekp
Aug 22 2016 08:36
https://debuggex.com is nice :sparkles:
Ari Winokur
@ariwinokur
Aug 22 2016 08:36
Then I get a red x
Help?
Nobody able to help in here right now?
jovmassimiliano
@jovmassimiliano
Aug 22 2016 08:41
function updateRecords(id, prop, value) {
if(prop!=="tracks" && value!==""){
collection[id][prop]=value;
}
else if(prop=="tracks")
{
collection[id].tracks=[value];
}
else if(prop=="tracks" && value!==""){
if(collection[id].hasOwnProperty("tracks")){
collection[id].prop.push(value);
}
}
else if(value===""){
delete collection[id][prop];
}
return collection;
}
how i could push the new tracks into the existing tracks property?
Ari Winokur
@ariwinokur
Aug 22 2016 08:48
@jovmassimiliano there's nobody in the channel to help right now.
I'm also stuck a few steps before you.
Pogg
@fogkio
Aug 22 2016 08:49
@jovmassimiliano same trouble here
jovmassimiliano
@jovmassimiliano
Aug 22 2016 08:49
i've been spend almost an hour to solving it LoL
Pogg
@fogkio
Aug 22 2016 08:50
i've been spend a day =))
Markus Kiili
@Masd925
Aug 22 2016 08:50
@jovmassimiliano You should not assign an array to the property if the property (array) exists. You should just push.
Pogg
@fogkio
Aug 22 2016 08:50
@Masd925 hiii
Markus Kiili
@Masd925
Aug 22 2016 08:51
@jovmassimiliano If prop is tracks and value non-empty, then make the hasOwnProperty check, and either push or assign.
Pogg
@fogkio
Aug 22 2016 08:52
slow code bro @Masd925
function updateRecords(id, prop, value) {
  if(collection[id][prop] !== "tracks" && value !== ""){
    collection[id].prop.value="value";
  }
  return collection;
i do this but doesnt work
Ari Winokur
@ariwinokur
Aug 22 2016 08:53
Working on "Using Objects for Lookups"
Markus Kiili
@Masd925
Aug 22 2016 08:53
@fogkio You should test value and prop and access collection on if blocks.
Ari Winokur
@ariwinokur
Aug 22 2016 08: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"
  };

  lookup[val];

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

// Change this value to test
phoneticLookup("charlie");
Pogg
@fogkio
Aug 22 2016 08:53
access collection?
right it's block cant change its :(
Winter S. Ndolo
@xulenvirp
Aug 22 2016 08:54

hey guys. who knows how to set a remainder (%) whose value is 2

and Set ting a remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.

This message was deleted
Pogg
@fogkio
Aug 22 2016 08:54
5%3=2
jovmassimiliano
@jovmassimiliano
Aug 22 2016 08:54
@Masd925 okay, let me try
Markus Kiili
@Masd925
Aug 22 2016 08:55
@fogkio You should be testing function input value and prop, not the contents of collection.
Pogg
@fogkio
Aug 22 2016 08:56
can you give me example?
Winter S. Ndolo
@xulenvirp
Aug 22 2016 08:56
thanks @fogkio
CamperBot
@camperbot
Aug 22 2016 08:56
:cookie: 211 | @fogkio |http://www.freecodecamp.com/fogkio
xulenvirp sends brownie points to @fogkio :sparkles: :thumbsup: :sparkles:
Markus Kiili
@Masd925
Aug 22 2016 08:57
@fogkio if (prop==="tracks" && value!=="") {...} <- collection is used here
Vladimir
@OXJIAMOH
Aug 22 2016 08:57
@ariwinokur you do nothing with result variable so your function returns empty string
Pogg
@fogkio
Aug 22 2016 08:58
hmmm let me try
w8 me a little bits
Winter S. Ndolo
@xulenvirp
Aug 22 2016 08:59
@fogkio How do you write the code for the remainder?
should it look like this ?
// Only change code below this line

var remainder 5 % 3 = 2;
Pogg
@fogkio
Aug 22 2016 08:59
@xulenvirp kayyy you do that
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:00
it didnt work @fogkio
Pogg
@fogkio
Aug 22 2016 09:00
2 ~~~> result of 5%3
you dont need to write that
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:00
oh okay @fogkio
Markus Kiili
@Masd925
Aug 22 2016 09:01
@xulenvirp Maybe you should assign the value gotten from the remainder operation 5 % 3 to the variable remainder using the assignment operator. It assigns from right side to left.
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:01

@Masd925 else if(prop=="tracks" && value!==""){
if(collection[id].hasOwnProperty("tracks"))
collection[id][prop].push(value);
}

can u give me more explanation, i'm still can't solve it

Pogg
@fogkio
Aug 22 2016 09:01
var remainder = 5%3  // = 2
@jovmassimiliano same you
Markus Kiili
@Masd925
Aug 22 2016 09:02
@jovmassimiliano If the property doesn't exist, you need to create it and assign [value].
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:03
thanks @fogkio
CamperBot
@camperbot
Aug 22 2016 09:03
xulenvirp sends brownie points to @fogkio :sparkles: :thumbsup: :sparkles:
:warning: xulenvirp already gave fogkio points
Pogg
@fogkio
Aug 22 2016 09:04
@jovmassimiliano now in object didnt have array track
we need to create an empty array to push value
this solve is to long =))
@Masd925 how can i push empty array into obj?
push?
Markus Kiili
@Masd925
Aug 22 2016 09:10
@fogkio If the tracks property exists, you can just collection[id][prop].push(value);
If not, you can create the property and assign a new array with the value collection[id][prop]=[value];
Another way in the second case is to assign an empty array and then push, but the end result is the same.
Egoscio
@Egoscio
Aug 22 2016 09:11
Still on that problem?
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:13
@Masd925 i'm already did to push an empty array if the property not exist, but i'm still confuse how to push new tracks into existing tracks property
Pogg
@fogkio
Aug 22 2016 09:14
@Masd925 @Egoscio yappp
Markus Kiili
@Masd925
Aug 22 2016 09:14
@jovmassimiliano New tracks are just strings, so collection[id][prop].push(value); works.
Pogg
@fogkio
Aug 22 2016 09:14
function updateRecords(id, prop, value) {
  if(prop !== "tracks" && value !== ""){
    if(collection[id].prop.hasOwnProperty("tracks")){//tracks exis
      collection[id][prop].push(value);
    }
    else{
        collection[id][prop]=[value];//not exis
      }
  }
  return collection;
undefined
collection[id][prop]
Markus Kiili
@Masd925
Aug 22 2016 09:15
@fogkio When the property key is in a variable like in prop here, you need to use the bracket notation.
Pogg
@fogkio
Aug 22 2016 09:15
oh no
oh no my mistake
Markus Kiili
@Masd925
Aug 22 2016 09:15
@fogkio .prop looks for property key "prop".
Pogg
@fogkio
Aug 22 2016 09:15
okay
i can push empty
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:17
else if(prop=="tracks" && value!==""){
if(collection[id][prop].hasOwnProperty("tracks"))
{
collection[id][prop].push(value);
}
else{
collection[id][prop]=[value];
}
}
@Masd925 still can't push into existing array
Pogg
@fogkio
Aug 22 2016 09:18
@jovmassimiliano see my code
function updateRecords(id, prop, value) {
  if(prop !== "tracks" && value !== ""){
    if(collection[id][prop].hasOwnProperty("tracks")){//tracks exis
      collection[id][prop].push(value);
    }
    else{
        collection[id][prop]=[value];//not exis
      }
  }
  return collection;
}
it work
Enes Gönültaş
@nsgonultas
Aug 22 2016 09:21
Hello. Can somebody help me? I'm on Exact Change challenge. What does it mean to have 1.01 pennies?
Markus Kiili
@Masd925
Aug 22 2016 09:22
@nsgonultas Penny is 0.01 and 1.01 is 101 pennies.
So it is 1.01 in pennies.
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:23
@fogkio it return undefined :(
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:23

hi guys. I am trying to pull the data from a webpage onto my page (for the quote challeng on free code camp) however I get the error: "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."

here is the code:

baseUrl = "http://www.brainyquote.com/quotes/keywords/websites.html";
$.ajax({
url: baseUrl,
type: "get",
dataType: "",
success: function(data) {
$("div").text("the data:" + data);
}
});

Enes Gönültaş
@nsgonultas
Aug 22 2016 09:24
@Masd925 this makes sense thanks.
CamperBot
@camperbot
Aug 22 2016 09:24
nsgonultas sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2329 | @masd925 |http://www.freecodecamp.com/masd925
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:24
  baseUrl = "http://www.brainyquote.com/quotes/keywords/websites.html";
  $.ajax({
    url: baseUrl,
    type: "get",
    dataType: "",
    success: function(data) {
      $("div").text("the data:" + data);
    }
  });
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:25
hey guys, who has done the challange called Compound Assignment with Augmented Addition?
var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a + 12;
b = 9 + b;
c = c + 7;
how does one put the += sign
a= 15, b= 26, c=19
Markus Kiili
@Masd925
Aug 22 2016 09:26
@xulenvirp a = a + 12; is the same as a += 12;
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:26
thanks @Masd925
CamperBot
@camperbot
Aug 22 2016 09:26
xulenvirp sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2330 | @masd925 |http://www.freecodecamp.com/masd925
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:26
@xulenvirp
a = 5;
b
= 3;
c *= 10;
``` 
a = 5;
b
= 3;
c *= 10;
```
Ricardo Araújo
@ricardomga
Aug 22 2016 09:27
@Anarchrist you have nothing in your data type, maybe thats the problem
Winter S. Ndolo
@xulenvirp
Aug 22 2016 09:28
I dont understand @Anarchrist but dont worry, its worked
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:28
@ricardomga tried with html and text
Ricardo Araújo
@ricardomga
Aug 22 2016 09:29
@Anarchrist you should be getting that from a API, not from a standard web page
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:29
@xulenvirp sorry having formatting issues but

a = a + b;
a+ = b;

is the s
@ricardomga Ah ... I am trying to grab the html between a specific div on a specific page "scrape the html" do you know of something I could read up on to figure it out?
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:31
@fogkio do you pass the challenge?may i see your code please to clearer my mind lol
Egoscio
@Egoscio
Aug 22 2016 09:32
@Anarchrist Do you have jQuery to your disposal or just plain Javascript?
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:32
@Egoscio jQuery is a go :)
Egoscio
@Egoscio
Aug 22 2016 09:33
Just select the element with the $ function like usual and you have access to the .html() method.
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:33

@fogkio i just need to push new array into existing tracks, but i'm doing in different way like this

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

}

Egoscio
@Egoscio
Aug 22 2016 09:33
When supplied with no arguments, it returns the HTML of the selected element. When provided with a string containing HTML or a variable referring to an HTML or jQuery object, it will set the target to the argument.
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:33
@Egoscio it seems to bomb as soon as I try to access the external page
Egoscio
@Egoscio
Aug 22 2016 09:34
What external page are you accessing and how?
Sorry I just get here.
jovmassimiliano
@jovmassimiliano
Aug 22 2016 09:34
@fogkio i've tried your code, it still can't solve
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:34
<script>

    $(document).ready(function() {

  baseUrl = "http://www.brainyquote.com/quotes/keywords/websites.html";
  $.ajax({
    url: baseUrl,
    type: "get",
    dataType: "html",
    success: function(data) {
      $("div").text("the data:" + data);
    }
  });
    });
</script>
Ricardo Araújo
@ricardomga
Aug 22 2016 09:35
@Anarchrist i used this API
Egoscio
@Egoscio
Aug 22 2016 09:35
So here's the thing. The web is very secure. You usually can't make AJAX requests to websites that are not on the same domain as yours.
Egoscio
@Egoscio
Aug 22 2016 09:36
There are two common workarounds. The first is JSONP, which is padded JSON. It only applies for API's really. The other is to use a CORS enabled proxy.
One that I would recommend is https://crossorigin.me/
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:37
@ricardomga Thanks for the resourse, I get the error "401 (Unauthorized)"
CamperBot
@camperbot
Aug 22 2016 09:37
anarchrist sends brownie points to @ricardomga :sparkles: :thumbsup: :sparkles:
:cookie: 268 | @ricardomga |http://www.freecodecamp.com/ricardomga
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:37
@Egoscio I will take a look at that, thanks man
CamperBot
@camperbot
Aug 22 2016 09:37
anarchrist sends brownie points to @egoscio :sparkles: :thumbsup: :sparkles:
:cookie: 23 | @egoscio |http://www.freecodecamp.com/egoscio
i have made this
Egoscio
@Egoscio
Aug 22 2016 09:42
@NixonRichard Nice, wanted to say the button appears to be empty, but loading the actual codepen shows the magnifying glass :+1:
NixonRichard
@NixonRichard
Aug 22 2016 09:42
yeah i dont know why that happens
btw this s the result of alot of helps from many ppl here
not my own totally
Egoscio
@Egoscio
Aug 22 2016 09:44
Just as a helpful remark, in the future it would be best if you could avoid using !important :)
NixonRichard
@NixonRichard
Aug 22 2016 09:46
oh yeah
NixonRichard
@NixonRichard
Aug 22 2016 09:50
i deleted the !important
and nothing changed
Noel Calonia
@noelc10
Aug 22 2016 09:51
hi guys, is there anyone here who are experts about x-editable plugin?
Mark Chaskelson
@Anarchrist
Aug 22 2016 09:55
@Egoscio You rock! Worked like a charm
 $.get("https://crossorigin.me/https://google.com", {}, function(content){
   $("div").html(content);
}, "html");
Brendan Kinahan
@BKinahan
Aug 22 2016 09:56
hello campers o/
Markus Kiili
@Masd925
Aug 22 2016 10:01
@BKinahan Yo!
Elazar Fein
@SkySibe
Aug 22 2016 10:02
Hi I want that the squers will fit into the div by size and I tried and didnt get it can you help?
http://codepen.io/elazar170/pen/BzEkvV
Egoscio
@Egoscio
Aug 22 2016 10:05
@Anarchrist Happy I could help :) Probably one of the most useful services you can find as a frontend developer trying to access external content on a regular basis.
Brendan Kinahan
@BKinahan
Aug 22 2016 10:06
@Masd925 Hey, how's it going?
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:06
hello campers, I have a problem with Falsy Bouncer Challenge. Why my code don't work?

function bouncer(arr) {
// Don't show a false ID to this bouncer.
falsyVal = [false, null, 0, "", undefined, NaN];
var newArr = arr.filter(function(val){
return val!==null && val!==false && val!==0 && val!==undefined && val!==NaN && val!=="";
});
return newArr;
}

bouncer([false, null, 0, NaN, undefined, ""]);

Egoscio
@Egoscio
Aug 22 2016 10:07
Please format your code
Brendan Kinahan
@BKinahan
Aug 22 2016 10:07
because NaN is tricky :)
Markus Kiili
@Masd925
Aug 22 2016 10:07
@minhbk NaN is not equal to anything and unequal to all values, so you need another test there.
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:07
how I can format my code :(
Brendan Kinahan
@BKinahan
Aug 22 2016 10:07
@minhbk
```js
your code here
```
Stephen James
@sjames1958gm
Aug 22 2016 10:08
@minhbk Use shift-enter to get new line without posting.
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:08
@BKinahan thanks you :D
CamperBot
@camperbot
Aug 22 2016 10:08
minhbk sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 2296 | @bkinahan |http://www.freecodecamp.com/bkinahan
Brendan Kinahan
@BKinahan
Aug 22 2016 10:08
@sjames1958gm howdy o/
Markus Kiili
@Masd925
Aug 22 2016 10:08
@BKinahan All well, how about you?
Stephen James
@sjames1958gm
Aug 22 2016 10:08
@BKinahan Good day, sir
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:08
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  falsyVal = [false, null, 0, "", undefined, NaN];
  var newArr = arr.filter(function(val){
    return val!==null && val!==false && val!==0 && val!==undefined && val!==NaN && val!=="";
  });
  return newArr;
}

bouncer([false, null, 0, NaN, undefined, ""]);
Stephen James
@sjames1958gm
Aug 22 2016 10:08
Good day @Masd925
@minhbk :+1: on the first try - :)
Markus Kiili
@Masd925
Aug 22 2016 10:09
@sjames1958gm Hello.
Brendan Kinahan
@BKinahan
Aug 22 2016 10:09
@Masd925 starting a new part-time (non-coding) job today. gotta pay those bills!
Keone Martin
@Athaman
Aug 22 2016 10:09
Hey folks, what's been happening?
bills must be paid
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:09
result : [null]
Noel Calonia
@noelc10
Aug 22 2016 10:09
hi guys, is there anyone here who are good at jquery x-editable plugin?
Markus Kiili
@Masd925
Aug 22 2016 10:11
@BKinahan I have to start learning php (at work). I have my valium, razorblades and mushroom ready.
Egoscio
@Egoscio
Aug 22 2016 10:11
@emonoel10 You're best off asking your question and possibly receiving an answer later if someone comes across it.
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:11
@BKinahan
bouncer([false, null, 0, NaN, undefined, ""]);
and the result: [null]
Markus Kiili
@Masd925
Aug 22 2016 10:11
@minhbk A test for val not being NaN is val===val.
Brendan Kinahan
@BKinahan
Aug 22 2016 10:11
@Masd925 1-up mushroom? ;)
@emonoel10 sorry, haven't used it.
Keone Martin
@Athaman
Aug 22 2016 10:12
PHP is less painful than i expected it to be.
Markus Kiili
@Masd925
Aug 22 2016 10:12
@BKinahan I think I will need some to force php in my brain.
@Athaman I know the basics, but not too much more.
Noel Calonia
@noelc10
Aug 22 2016 10:13
@Egoscio ok, my apology
@BKinahan ok, np (y)
Egoscio
@Egoscio
Aug 22 2016 10:13
No apologies :) Just giving a little suggestions
Keone Martin
@Athaman
Aug 22 2016 10:13
yeah, i'm actually doing a uni assignment in php at the moment
so am learning the basics at present.
Stephen James
@sjames1958gm
Aug 22 2016 10:14
@minhbk I ran that in the devtools and the response is actually [NaN]
Noel Calonia
@noelc10
Aug 22 2016 10:14
ill just w8 for someone who know about x-editable
Markus Kiili
@Masd925
Aug 22 2016 10:14
@minhbk FCC console shows NaN as null.
Keone Martin
@Athaman
Aug 22 2016 10:14
it's probably worth asking the question in case someone knows the answer from another tech
unless it's a very specific to x-editable question
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:15
@Masd925 @sjames1958gm oh, thanks you. How I can remove NaN?
CamperBot
@camperbot
Aug 22 2016 10:15
minhbk sends brownie points to @masd925 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2786 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 2331 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Aug 22 2016 10:16
@minhbk A test for val not being NaN is val===val.
It is only false if val is NaN.
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:16
@Masd925 How I can remove NaN in this array?
[false, null, 0, NaN, undefined, ""]
Keone Martin
@Athaman
Aug 22 2016 10:16
so noob question time, i know how to use regex in search and replace but i'm trying to do form validation to check if a user input number matches my regex pattern... do i just use ==? or is there a method for it?
Noel Calonia
@noelc10
Aug 22 2016 10:17
@Athaman id tried asking to other communities and chat groups here but it seems they dnt know about it
Markus Kiili
@Masd925
Aug 22 2016 10:17
@minhbk You can use the code you have and test val not being NaN with val===val instead of val!==NaN.
Stephen James
@sjames1958gm
Aug 22 2016 10:17
@Athaman match is good for checking if there is a match
Keone Martin
@Athaman
Aug 22 2016 10:18
hah... should probably have thought of that. looked for compare, and equals functions
Stephen James
@sjames1958gm
Aug 22 2016 10:18
@Athaman It's right there in the question :) if a user input number matches my regex pattern
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:20
@Masd925 haha, thanks for support :D wtf js :))
CamperBot
@camperbot
Aug 22 2016 10:20
minhbk sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: minhbk already gave masd925 points
stonefmagiecurata
@stonefmagiecurata
Aug 22 2016 10:21
@minhbk go with @Masd925 's tip, NaN is the only value which is not equal with itself
Keone Martin
@Athaman
Aug 22 2016 10:21
@sjames1958gm hah yeah :D i guess it's my java background again... comparing strings with equals() and compareTo()
Stephen James
@sjames1958gm
Aug 22 2016 10:22
@Athaman c++ has a much less complete standard lib.
Keone Martin
@Athaman
Aug 22 2016 10:22
@sjames1958gm thanks for the tip. now i just need to figure out the right regex... unless someone feels like volunteering a pattern to confirm that there are between 6-10 numbers in the string ;)
CamperBot
@camperbot
Aug 22 2016 10:22
athaman sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2787 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Markus Kiili
@Masd925
Aug 22 2016 10:22
@minhbk JS NaN represents like zillion different IEEE 754 standard's floating point error values, so therefore it has been set not to be equal to even itself.
Vladimir
@OXJIAMOH
Aug 22 2016 10:23
@Athaman maybe online regexp can help you with pattern test https://regex101.com/
Keone Martin
@Athaman
Aug 22 2016 10:23
i'm there at the moment :)
/^[0-9]{6,10}/ looks like what i want but didn't seem to work
Stephen James
@sjames1958gm
Aug 22 2016 10:24
@Athaman /^\d{6,10}$/
Nguyễn Trí Minh
@minhbk
Aug 22 2016 10:24
@Masd925 ok, I got it :+1:
Keone Martin
@Athaman
Aug 22 2016 10:25
ok, yeah that's what i had more or less, maybe i've got my logic broken. thanks again @sjames1958gm and @OXJIAMOH
CamperBot
@camperbot
Aug 22 2016 10:25
athaman sends brownie points to @sjames1958gm and @oxjiamoh :sparkles: :thumbsup: :sparkles:
:warning: athaman already gave sjames1958gm points
:cookie: 316 | @oxjiamoh |http://www.freecodecamp.com/oxjiamoh
Stephen James
@sjames1958gm
Aug 22 2016 10:25
@Athaman The $ will pin to end of string so trailing digits are not accepted
Keone Martin
@Athaman
Aug 22 2016 10:25
i had the $ in to start but wasn't sure about it so took it out for my most recent shot
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:31
hey guys, who has done this challange?
Convert Celsius to Fahrenheit
Keone Martin
@Athaman
Aug 22 2016 10:31
most of us :)
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:31
asweome
Muhammad Hasham
@MohammadHasham
Aug 22 2016 10:31
@xulenvirp where are u stucked at?
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:32

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

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

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

Muhammad Hasham
@MohammadHasham
Aug 22 2016 10:32
use the formula provided there
just use it and pass the argument in it
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:32
function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line


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

// Change the inputs below to test your code
convertToF(30);
i dont know what to do
Huy Tran
@revantou
Aug 22 2016 10:33
running into a bug on smallest-common-multiple. the test cases are bugged. it looks like the numbers are a bit messed up. it says smallestCommons([1, 5]) should return 60.
Muhammad Hasham
@MohammadHasham
Aug 22 2016 10:33
@xulenvirp you are given with the formula
please use that
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:33
there is no formula @MohammadHasham
Moon Man
@CEREBR4L
Aug 22 2016 10:33
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:33
oh nevermind
Muhammad Hasham
@MohammadHasham
Aug 22 2016 10:34
f=celsius*9/5+32
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:34
yeah
Muhammad Hasham
@MohammadHasham
Aug 22 2016 10:34
just use that and pass argument
@xulenvirp
Stephen James
@sjames1958gm
Aug 22 2016 10:36
@revantou For that solution [1,5] should return 60 - it is the smallest common multiple of 1, 2, 3, 4, 5 - the input is a range
Huy Tran
@revantou
Aug 22 2016 10:36
ack, I see
thanks
Markus Kiili
@Masd925
Aug 22 2016 10:37
@revantou If you use too inefficient algorithm on that challenge, FCC editor might not accept it.
Manoj
@Manoj-Fernando
Aug 22 2016 10:39
can someone help me in word blanks
the test cases are not getting passed
mblicker
@mblicker
Aug 22 2016 10:41
Anyone on the Escape Sequences in Strings challenge?
Huy Tran
@revantou
Aug 22 2016 10:42
@Masd925 thanks, I'll keep that in mind, I have an idea that may work.
CamperBot
@camperbot
Aug 22 2016 10:42
revantou sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2332 | @masd925 |http://www.freecodecamp.com/masd925
Manoj
@Manoj-Fernando
Aug 22 2016 10:44
@mblicker yeah
jaiswalpragati
@jaiswalpragati
Aug 22 2016 10:45
please any one help me in Word Blanks challenge.,I m not getting exact output.
Manoj
@Manoj-Fernando
Aug 22 2016 10:45
@jaiswalpragati what is your problem?
Joseph
@appwebtech
Aug 22 2016 10:48
@xulenvirp Habari gani?
Lemmie see if I can help you with the celsius thingy....
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:48
Joseph niko shwari
ive been assisted @appwebtech
Joseph
@appwebtech
Aug 22 2016 10:49
I was running the code you posted in Sublime......gave me something like this;

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

// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}

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

Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:50
@appwebtech pc
Joseph
@appwebtech
Aug 22 2016 10:51
I'm running a MAC, lakini code yenyewe is the same even in PC's. Try to see if it solves your project.
What are you designing by the way @xulenvirp
Winter S. Ndolo
@xulenvirp
Aug 22 2016 10:53
im still learning Java @appwebtech
Joseph
@appwebtech
Aug 22 2016 10:53
What's the exact challenge @Manoj-Fernando
Egoscio
@Egoscio
Aug 22 2016 10:53
since when is Javascript platform specific?
Joseph
@appwebtech
Aug 22 2016 10:54
Ahh cool @xulenvirp
Manoj
@Manoj-Fernando
Aug 22 2016 10:55
guys does javascript support multi-datatype?
could a same array hold a string and number?
Egoscio
@Egoscio
Aug 22 2016 10:56
Yeah.
Joel Santos
@St3ps
Aug 22 2016 10:56
@Manoj-Fernando Yeap