These are chat archives for FreeCodeCamp/Help

4th
Sep 2018
Aditya
@ezioda004
Sep 04 2018 00:00
So it looks like
 *
***
 *
Your output looks like ****
Karma Drukpa
@coderkarma
Sep 04 2018 00:02
I know, don't know how should i go for it.
do i need to do second for loop ?
Kyle Holm
@thekholm80
Sep 04 2018 00:05
oh dear

scroll down to where it says

\n new line

then look at what @ezioda004 wrote and ask yourself if you've done anything similar to how he's getting new lines
the next problem is your lack of whitespace. the first line is  * but you're not putting spaces in your strings
Aditya
@ezioda004
Sep 04 2018 00:08
@coderkarma Its something called new line denoted with \n makes the output go to next line..I'm sure they taught this in JS basics at FCC.
Karma Drukpa
@coderkarma
Sep 04 2018 00:13
one more question.
@ezioda004 @thekholm80
can i sort word doing like that @ezioda004
Aditya
@ezioda004
Sep 04 2018 00:16
Why do you have nested loop?
Kyle Holm
@thekholm80
Sep 04 2018 00:16
this looks like a good place for some String.match()
Aditya
@ezioda004
Sep 04 2018 00:17
I mean..why do you have nested loop structured like that? You're iterating over every character and then for each character you're iterating over words
Karma Drukpa
@coderkarma
Sep 04 2018 00:18
because I want to know that each word number
ok let me make some changes
Kyle Holm
@thekholm80
Sep 04 2018 00:19
oh it worked
dunno about all the test cases, but handled that one lol
Karma Drukpa
@coderkarma
Sep 04 2018 00:20
@thekholm80 which code worked?
Kyle Holm
@thekholm80
Sep 04 2018 00:20
i split the string, sorted the array, joined back to string and returned
Aditya
@ezioda004
Sep 04 2018 00:20
@coderkarma words.sort(); will also loop and compare the words
Karma Drukpa
@coderkarma
Sep 04 2018 00:22
@thekholm80 how come ? sorted has to be done by numbers isn't it?
Aditya
@ezioda004
Sep 04 2018 00:22
@coderkarma Do you understand how .sort() works?
Kyle Holm
@thekholm80
Sep 04 2018 00:23
i did sort by numbers. each word has a number in it
so i pulled those numbers out and compared them
Aditya
@ezioda004
Sep 04 2018 00:24
Thats sounds about right
Kyle Holm
@thekholm80
Sep 04 2018 00:24
i'm sure it's super slow and expensive, but it's one line so still a win?
Karma Drukpa
@coderkarma
Sep 04 2018 00:24
@ezioda004 I was trying to get the number of word and sort it as well.
Aditya
@ezioda004
Sep 04 2018 00:24
@coderkarma I think I solved this one a long time ago, whats it called?
Karma Drukpa
@coderkarma
Sep 04 2018 00:25
what is wrong with my code @thekholm80 @thekholm80
Kyle Holm
@thekholm80
Sep 04 2018 00:25
it doesn't work
Karma Drukpa
@coderkarma
Sep 04 2018 00:25
your order please ?
Kyle Holm
@thekholm80
Sep 04 2018 00:25
and it's disappeared
Aditya
@ezioda004
Sep 04 2018 00:25
@thekholm80 Nah, its how it should be done. You'll have to sort the words regardless, and .sort() uses quick sort which is fastest
Karma Drukpa
@coderkarma
Sep 04 2018 00:25
codewars
@ezioda004 what do i need to get it right
Aditya
@ezioda004
Sep 04 2018 00:26

You didnt answer my question

Do you understand how .sort() works?

Karma Drukpa
@coderkarma
Sep 04 2018 00:28
@ezioda004 may be with index value
@ezioda004 precisely don't know how it works but I always assume it works with its value
Aditya
@ezioda004
Sep 04 2018 00:29
What is a and b in .sort((a, b) = > a - b);?
Kyle Holm
@thekholm80
Sep 04 2018 00:29
Array.sort(function(a, b) {
  // compare some value of a vs some value of b
  // if a is less than b, return -1
  // if a === b, return 0
  // if a is greater than b, return 1
})

// or shorthand
Array.sort((a, b) => a - b)
Karma Drukpa
@coderkarma
Sep 04 2018 00:32
may those are index value @ezioda004 .
Kyle Holm
@thekholm80
Sep 04 2018 00:32
image.png
i guess you could say things are getting pretty serious
almost 1/2 as much as @ezioda004
and 1/5 of @Manish-Giri
Aditya
@ezioda004
Sep 04 2018 00:34
@coderkarma Nope, a and b are individual elements...so if you have say [1, 2, 3] then a and b are 1, 2, 2, 3 and 1, 3
Comparison b/w these pairs happen and thats how the array gets sorted
@thekholm80 :star2: dont think I've ever used any of the privileges from codewars
Kyle Holm
@thekholm80
Sep 04 2018 00:36
i didn't know there were privileges lol
Aditya
@ezioda004
Sep 04 2018 00:37
Hah there are, I guess they unlock when you hit a new rank or get honors like 500, 1000 etc
1/4 to go for 3 kyu :D
Kyle Holm
@thekholm80
Sep 04 2018 00:39
i'm still floating at 5kyu
guess that's what i get for only solving the easy stuff
Aditya
@ezioda004
Sep 04 2018 00:40
Tbh some of the higher katas are absurd, they expect you to know languages obsolete interaction which you'll never use again
Kyle Holm
@thekholm80
Sep 04 2018 00:41
that's how the 4s i've done were
kind of tedious
Aditya
@ezioda004
Sep 04 2018 00:42
Yeah those are not fun, I'd rather do lower ones which makes you solve stuff instead of relying on some tricks you may/may not know
Karma Drukpa
@coderkarma
Sep 04 2018 00:49
@thekholm80 @ezioda004 to check each element of arr, we could do something like this right typeof ele === "number"
Kyle Holm
@thekholm80
Sep 04 2018 00:50
not for the kata you're working on
Aditya
@ezioda004
Sep 04 2018 00:51
Each element is a string, however theres a number in that string, you should probably think about how you'd extract the number from a single word first.
i used regex in my solution, it worked well for me
Karma Drukpa
@coderkarma
Sep 04 2018 01:00
Number(ele)
Kyle Holm
@thekholm80
Sep 04 2018 01:00
are you just guessing?
Karma Drukpa
@coderkarma
Sep 04 2018 01:00
nope
i m sure
Karma Drukpa
@coderkarma
Sep 04 2018 01:07
function order(words){
// split the word into arr
// loop through the arr
// do second loop and loop through each element of word
// check to see if the ele of word is number 
// sort the word by Number of word
// return the sorted word with and join the to make string of words
 let word = words.split(' ');
    for (let i = 0; i < word.length; i++){
        let current = word[i];

       let newArr = current.split('');
        for (let j = 0; j < newArr.length; j++){
          let ele = newArr[j];
        //    console.log(ele);
          if(Number(ele)){
             console.log(Number(ele));

            }
         }
     }
}
 order("is2 Thi1s T4est 3a");
Kyle Holm
@thekholm80
Sep 04 2018 01:07
lots of NaN?
oh wait, you've got it in an if statement
Karma Drukpa
@coderkarma
Sep 04 2018 01:08
I am trying to sort based on the number but strugging
Kyle Holm
@thekholm80
Sep 04 2018 01:08
you're trying to sort by converting a word into a number
which is not going to turn out like you're hoping
Karma Drukpa
@coderkarma
Sep 04 2018 01:10
how should i go in my if statement ?
Aditya
@ezioda004
Sep 04 2018 01:11
@thekholm80 Funnily it works out cause NaN is falsy value
So he does get filtered stuff
@coderkarma Do you remember how bubble sort works?
Manish Giri
@Manish-Giri
Sep 04 2018 01:13
@thekholm80 I wanna get to 10k someday
:thought_balloon:
Kyle Holm
@thekholm80
Sep 04 2018 01:13
@coderkarma i've told you 3 different times now how you could approach it. you ignored the first 3, i'm not trying again
Karma Drukpa
@coderkarma
Sep 04 2018 01:13
@ezioda004 yes swapping
Kyle Holm
@thekholm80
Sep 04 2018 01:13
@Manish-Giri you can do it
Manish Giri
@Manish-Giri
Sep 04 2018 01:13
lol
maybe by the time musk has colonized mars
Karma Drukpa
@coderkarma
Sep 04 2018 01:14
@thekholm80 I didn't ignored.
Aditya
@ezioda004
Sep 04 2018 01:15

@coderkarma Heres what you can do

for (let j = 0; j < newArr.length; j++){
          let ele = newArr[j];
        //    console.log(ele);
          if(Number(ele)){
            return ele;

            }
         }

Make this a function, which accepts a word, so you'll get the number from this function everytime you execute, now you can do bubble sort the array based on the returned values from this function

Karma Drukpa
@coderkarma
Sep 04 2018 01:18
sure, thanks
Manish Giri
@Manish-Giri
Sep 04 2018 01:29
@coderkarma are you doing the Your order, please kata
Karma Drukpa
@coderkarma
Sep 04 2018 01:41
yes sir
@Manish-Giri
Karma Drukpa
@coderkarma
Sep 04 2018 01:46
:fire:
thanks
Kyle Holm
@thekholm80
Sep 04 2018 01:53
@ezioda004 no more screen flashes
Aditya
@ezioda004
Sep 04 2018 01:59
@thekholm80 In your game?
Kyle Holm
@thekholm80
Sep 04 2018 02:00
yeah
Aditya
@ezioda004
Sep 04 2018 02:03
Nice, did you optimize with an offscreen canvas?
Kyle Holm
@thekholm80
Sep 04 2018 02:04
nope, i took out the clearRect() methods so i'm just redrawing over old images lol
screen will never flash if you never clear it
Aditya
@ezioda004
Sep 04 2018 02:07
Ah that'll do :fire:
Kyle Holm
@thekholm80
Sep 04 2018 02:07
no lag or anything, so seems to be a good fix
psyperl
@psyperl
Sep 04 2018 02:58
grats on the fix
I actually thought it was the other way around :smile:
Karma Drukpa
@coderkarma
Sep 04 2018 03:39
:crying_cat_face:
Bjorn van de Peut
@bjorno43
Sep 04 2018 03:55
@thekholm80 Of course I did get it unbanned. Luckily the ppl behind Gitter are quite friendly and willing to help when asked :)
Kyle Holm
@thekholm80
Sep 04 2018 03:55
what about @bobsbot 1.0?
did you get him unbanned too?
Bjorn van de Peut
@bjorno43
Sep 04 2018 03:55
Ye also unbanned
Kyle Holm
@thekholm80
Sep 04 2018 03:55
dang, you're rolling in bots now
Bjorn van de Peut
@bjorno43
Sep 04 2018 03:56
lol
Kyle Holm
@thekholm80
Sep 04 2018 03:56
time to open an online brothel
Bjorn van de Peut
@bjorno43
Sep 04 2018 03:56
:joy:
Matt
@matteprg
Sep 04 2018 03:58
hey everyone need some help on React: Use Default Props anyone already completed this one?
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:04
Too bad no one is really interested in adding challenges to the bot though. So far only 1 user added a challenge to it. It needs a whole lot more challenges if the bot is ever going to be interesting
Aditya
@ezioda004
Sep 04 2018 04:05
@matteprg You can post your query, someone might be able to help.
@bobsbot challenge
Kyle Holm
@thekholm80
Sep 04 2018 04:06
@bjorno43 you need to find a way for people to find the submission link easily
@bobsbotty challenge
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:06
@ezioda004 I don't have it turned on at the moment
Aditya
@ezioda004
Sep 04 2018 04:07
🤖beep boop
Karma Drukpa
@coderkarma
Sep 04 2018 04:07

JAVASCRIPT!!!!!!!!!!!

Bjorn van de Peut
@bjorno43
Sep 04 2018 04:07
@thekholm80 I did. There's a message in the LetsPair room about it. There's also a forum post about it. And the bot itself also has the link when requesting help. There's not much else I can do
Kyle Holm
@thekholm80
Sep 04 2018 04:07
@bobsbot help
huh
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:08
Give me a min, I'll turn it on
Kyle Holm
@thekholm80
Sep 04 2018 04:08
seems like there's at least one thing you can do
Aditya
@ezioda004
Sep 04 2018 04:08
@coderkarma Are you ok?
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:08
Alright, turned it on. It's running under @bobsbot
Matt
@matteprg
Sep 04 2018 04:08
const ShoppingCart = (props) => { return ( <div> <h1>Shopping Cart Component</h1> </div> ) }; // change code below this line
Karma Drukpa
@coderkarma
Sep 04 2018 04:09
yes but not quite well............ algo
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:09
@bobsbot help
bobsbot
@bobsbot
Sep 04 2018 04:09
@bjorno43 Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Matt
@matteprg
Sep 04 2018 04:09
its askind to add default props
not sure what to add here
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:10
@bobsbot help challenges
bobsbot
@bobsbot
Sep 04 2018 04:10

@bjorno43 Similar to Codewars, I can provide Javascript challenges which you need to solve.
To see the current challenge (command: challenge)
To input your solution (command: solve) followed by your code between 3 backticks
To see the ranks (command: ranks)
To see how many points you've earned (command: points)

If you wish to contribute your own challenge, please go to https://www.icecub.nl/gitter/bobsbotty and follow the instructions

Aditya
@ezioda004
Sep 04 2018 04:10
@matteprg There's an example in the challenge:
MyComponent.defaultProps = { location: 'San Francisco' }
Matt
@matteprg
Sep 04 2018 04:12
@ezioda004 so do I just put MyComponent.defaultProps = { items=0} at the bottom and then ReactDOM.Render()
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:14
Probably somewhere later today I'll start adding some proper comments to the bots source and release it on Github. I've had a few requests for it so might as well get that over with.
Aditya
@ezioda004
Sep 04 2018 04:15
@matteprg The component name is ShoppingCart and you're assigning an object to it so key value pair { items: 0 }
In Stateful component I'd do
class ShoppingCart extends Component {
  static defaultProps = {
  }
}
Looks nicer
Matt
@matteprg
Sep 04 2018 04:16
thaks
that did it
awesome
I really appreciate it
Aditya
@ezioda004
Sep 04 2018 04:17
:thumbsup:
Matt
@matteprg
Sep 04 2018 04:17
was driving me nuts and I was just not understanding
Aditya
@ezioda004
Sep 04 2018 04:17
Take it slow, React is handful the first time :smile:
Matt
@matteprg
Sep 04 2018 04:18
yeah its a whole new way of thinking about applications
Aditya
@ezioda004
Sep 04 2018 04:19
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 04:19

@ezioda004 The current challenge is:
Write a function that takes 3 arguments, each representing a RBG decimal value. The function should return the hexadecimal representation of the RGB value.

Rules:

  • The name of the function should be: rgb.
  • The valid decimal values for RGB are 0 - 255.
  • Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.
  • The hexadecimal representation must be upper case.

Example:
rgb(255, 255, 255); should return: FFFFFF.

Claudio Restifo
@Marmiz
Sep 04 2018 04:22
@bjorno43 I'll add some...some day™
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:23
@Marmiz Thanks, that'll be great :)
Aditya
@ezioda004
Sep 04 2018 04:27
@bobsbot solve
function rgb(...colors){
  return colors.map(color => color < 1 ? "00" : (color > 255 ? 255 : color).toString(16).toUpperCase()).join("");
}
bobsbot
@bobsbot
Sep 04 2018 04:27
@ezioda004 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Aditya
@ezioda004
Sep 04 2018 04:27
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 04:27

@ezioda004 The current challenge is:
Create a function that takes an array as argument. Return the amount of smileys in the array.

Rules:

  • The name of the function should be: countSmileys.
  • Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;.
  • A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~.
  • Every smiling face must have a smiling mouth that should be marked with either ) or D.
  • No additional characters are allowed except for those mentioned.
  • In case of an empty array return 0.

Example:
countSmileys([':)', ';(', ';}', ':-D']); should return: 2.

Bjorn van de Peut
@bjorno43
Sep 04 2018 04:29
@bobsbot ranks
bobsbot
@bobsbot
Sep 04 2018 04:29
@bjorno43
  1. alpox with 4 points!
  2. bjorno43 with 3 points!
  3. ezioda004 with 2 points!
Aditya
@ezioda004
Sep 04 2018 04:37
@bobsbot solve
function countSmileys(arr){
  return arr.filter(val => val.match(/[:;].*(?=[D)])/)).length;
}
bobsbot
@bobsbot
Sep 04 2018 04:37
@ezioda004 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Aditya
@ezioda004
Sep 04 2018 04:37
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 04:37

@ezioda004 The current challenge is:
Create a function that takes an array as argument. Return the amount of smileys in the array.

Rules:

  • The name of the function should be: countSmileys.
  • Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;.
  • A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~.
  • Every smiling face must have a smiling mouth that should be marked with either ) or D.
  • No additional characters are allowed except for those mentioned.
  • In case of an empty array return 0.

Example:
countSmileys([':)', ';(', ';}', ':-D']); should return: 2.

Aditya
@ezioda004
Sep 04 2018 04:37
@bobsbot solve
function countSmileys(arr){
  return arr.filter(val => val.match(/[:;].*(?=[D)])/)).length;
}
bobsbot
@bobsbot
Sep 04 2018 04:37
@ezioda004 Congratulations! Your solution is correct!
You were not granted any points for this solution because you've already solved this challenge before.
psyperl
@psyperl
Sep 04 2018 04:38
@bobsbot solve
/// from copy paste programmer
function countSmileys(arr){
  return arr.filter(val => val.match(/[:;].*(?=[D)])/)).length;
}
bobsbot
@bobsbot
Sep 04 2018 04:38
@psyperl Please provide your solution between 3 backticks.
Aditya
@ezioda004
Sep 04 2018 04:38
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 04:38

@ezioda004 The current challenge is:
Given a strictly positive integer, output "fizzbuzz" if the number is a multiple of 15, "fizz" if the number is a multiple of 3 (but not 15), and "buzz" if the number is a multiple of 5 (but not 15). If the number is not a multiple of 3, 5, or 15, return the number as passed.

Rules:

  • The function must be named fizzBuzz, accepting a single numeric argument that will be a strictly positive integer
  • All return values must be in lowercase if they are strings
  • If the return value is the number as passed, it must not be coerced to a string (i.e. it must remain of the type Number)

Example:
fizzBuzz(6) should return "fizz"
fizzBuzz(10) should return "buzz"
fizzBuzz(30) should return "fizzbuzz"
fizzBuzz(5) should return "buzz"
fizzBuzz(91) should return 91

Aditya
@ezioda004
Sep 04 2018 04:38
@psyperl Woops sorry
psyperl
@psyperl
Sep 04 2018 04:38
lol
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:39
@ezioda004 It wouldn't have mattered. After you provided a solution, a new challenge was selected. His solution would no longer work
psyperl
@psyperl
Sep 04 2018 04:39
not my solution was his lol
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:39
Ah lol
Aditya
@ezioda004
Sep 04 2018 04:39
It selected the same challenge and I skipped it aha
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:40
But ye, this is downside af having only 5 different challenges at the moment. There's a 20% chance it'll select the same challenge
psyperl
@psyperl
Sep 04 2018 04:41
can pass previous challenge as a param and recalculate random if it matched the previous
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:41
At first I thought about using a counter so it checks how many times each challenge has been solved before selecting it again. But I run into several issues doing that
Aditya
@ezioda004
Sep 04 2018 04:41
You can perhaps let the challenge exhaust and create a new array of challenge so all the previous ones are consumed first instead of selecting a random one everytime
psyperl
@psyperl
Sep 04 2018 04:42
thats even better
@bjorno43 do you have execution time of result?
things like performance problem could be expose fastest code replaced the slower code challenge.. one fastest algorithm winner
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:45
Well, the problem is that new challenges keep being added. It's easy to keep track of which challenges have been solved and how many times. Lets say I have an integer in the database named "solved" and count that +1 everytime. After that it's a simple matter of selecting where 0. No rows returned? +1 one and repeat untill rows are returned. The problem is that the bot would need to restart once a new challenge is added. Because it would have 0 while the both might be somewhere at 5 on selecting. And if I were to count from 0 every single time, the performance would suffer very fast
Aditya
@ezioda004
Sep 04 2018 04:46
@bobsbot solve
function fizzBuzz(num){
  return num % 15 == 0 ? "fizzbuzz" : num % 3 ? num % 5 ? num : "buzz" : "fizz";
}
bobsbot
@bobsbot
Sep 04 2018 04:46
@ezioda004 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:48
@ezioda004 That might be an idea. Though I'd have to revise the code for it. Right now it doesn't select all the available challenges on run. It just selects 1 challenge from the database and that's it.
Basicly there's a column in the database named "current" with the value 1 if it's the currect challenge. After a solution it'll update that one to 0 and select a random row where it updates it to 1 again.
I could have it update a random one to 1 first before turning the current one to 0. That'll make sure it can't select the same one. But there would be a very small chance that someone types the command "challenge" while it's performing these queries. That would shut the bot down because of an SQL error as 2 rows would be current at the same time. That's why I didnt do this
Aditya
@ezioda004
Sep 04 2018 04:53
Cant you block any commands when its querying the DB?
Bjorn van de Peut
@bjorno43
Sep 04 2018 04:54
Well technically you could. Though I think there might be a much simpler solution based on your idea
I could create an empty array and fill it with the ids of each row that has been solved. Then just reset that array once it contains all possible ids
Though once there are 50+ challenges in the database, the chances of getting the same challenge becomes very small
Aditya
@ezioda004
Sep 04 2018 04:58
How are the challenges stored? If they are stored as an object then I'd like make an array of random indexes and save that in the DB, so when someone ask for challenge, it pop off the last element, the DB selects the challenge and it keeps doing it until the length of that array is 0. When the length is 0, create an array with random indexes and repeat the process.
Bjorn van de Peut
@bjorno43
Sep 04 2018 05:01
The challenges aren't stored at all. It completely depends on the database for it. When you request the current challenge, it'll query the database where current = 1. When you solve it, it'll update current to 0 and randomly update one to 1. It doesn't hold any challenge inside an object or anything
I mean, when you solve a challenge, it'll just select the tests and their expected outputs from the database where current is 1 and runs them against your solution, verifying the outputs
Aditya
@ezioda004
Sep 04 2018 05:04
Ahh hard to fully understand without looking at the Schema :sweat_smile:
Bjorn van de Peut
@bjorno43
Sep 04 2018 05:11
Ye that's why I'll make a repo with the source somewhere later today. That'll make it a lot easier I guess
Aditya
@ezioda004
Sep 04 2018 05:22
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 05:22

@ezioda004 The current challenge is:
Add a new method to the String object in Javascript. This method should turn the string into a valid PascalCase string.

Rules:

  • The name of the method should be pascalCase
  • All words in the string must have their first letter capitalized
  • There can be no spaces in the result

Example:
"hello case".pascalCase(); should return: HelloCase

Claudio Restifo
@Marmiz
Sep 04 2018 05:42
@bobsbot help
bobsbot
@bobsbot
Sep 04 2018 05:42
@Marmiz Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Claudio Restifo
@Marmiz
Sep 04 2018 05:42
@bobsbot help challenge
i'm dumb
@bobsbot solve
String.prototype.pascalCase = function() {
  return this.replace(/\b[a-z]/g, char => char.toUpperCase()).split(" ").join('')
}
bobsbot
@bobsbot
Sep 04 2018 05:42
@Marmiz Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Claudio Restifo
@Marmiz
Sep 04 2018 05:43
hehehe this is fun
Aditya
@ezioda004
Sep 04 2018 05:44
I wonder if the bot supports negative lookahead
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 05:44

@ezioda004 The current challenge is:
Create a function that takes an array as argument. Return the amount of smileys in the array.

Rules:

  • The name of the function should be: countSmileys.
  • Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;.
  • A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~.
  • Every smiling face must have a smiling mouth that should be marked with either ) or D.
  • No additional characters are allowed except for those mentioned.
  • In case of an empty array return 0.

Example:
countSmileys([':)', ';(', ';}', ':-D']); should return: 2.

Bjorn van de Peut
@bjorno43
Sep 04 2018 05:47
@ezioda004 You don't need to do a challenge if you wish to test JS code. You can just send it your own code and make it output the result
@bobsbot help javascript
bobsbot
@bobsbot
Sep 04 2018 05:47

@bjorno43 Put your Javascript code between 3 backticks and I will return you its result.
Do NOT use console.log(). Instead, call the result directly, like:

let example = 'Hello World!';
example;

Use JSON.stringify() or array.toString() to output arrays.

Current limitations:

  • I can only output 1 result at a time. (Don't output results in a loop as it will only return the last loop)
  • My time limit is set to 10 seconds. Scripts taking more time will be killed
  • My memory limit is set to 10 MegaBytes. Scripts taking more memory will be killed
Bjorn van de Peut
@bjorno43
Sep 04 2018 05:59
@ezioda004 Alright, I've released the source code here: https://github.com/bjorno43/Bobsbotty
Aditya
@ezioda004
Sep 04 2018 06:01
@bjorno43 Thanks I'll have a look
@bobsbot let x = "hello world".replace(/^\w|(?<=\s)\w/g, x => x.toUpperCase()); x;
bobsbot
@bobsbot
Sep 04 2018 06:01
@ezioda004 There was an error with your Javascript code:
V8Js::compileString():2: SyntaxError: Invalid regular expression: /^\w|(?<=\s)\w/: Invalid group
Aditya
@ezioda004
Sep 04 2018 06:02
Aw it doesnt support
Bjorn van de Peut
@bjorno43
Sep 04 2018 06:06
@ezioda004 Actually, even my browser returned the same error :P
Aditya
@ezioda004
Sep 04 2018 06:09
Yeah its from ES2018, it works on my chrome
Bjorn van de Peut
@bjorno43
Sep 04 2018 06:10
Ah. Ye I could've told you that doesn't work. It doesn't support ES2018
psyperl
@psyperl
Sep 04 2018 06:11
look behind?
Bjorn van de Peut
@bjorno43
Sep 04 2018 06:11
Though appearently V8Js released a version that does support it. I'll have a look at that later
Anand Potukuchi
@anandpotukchi
Sep 04 2018 06:54
ES2018 is cool
thanks for the heads up @ezioda004 @bjorno43
my soln:
```
function titleCase(str) {
var sentence = str.toLowerCase().split(" ").join(" ").str[0].toUpperCase();

 return sentence;


}
titleCase("I'm a little tea pot");
Bjorn van de Peut
@bjorno43
Sep 04 2018 07:59
@anandpotukchi You're supposed to capitalize the first letter of each word. Right now you're capitalizing only the first letter of the entire string
Bjorn van de Peut
@bjorno43
Sep 04 2018 08:05
Should probably be something like return str.toLowerCase().split(' ').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
@bobsbot
"tHiS iS a TEsT".toLowerCase().split(' ').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
bobsbot
@bobsbot
Sep 04 2018 08:07
@bjorno43 The result of your Javascript code is:
This Is A Test
Stephen James
@sjames1958gm
Sep 04 2018 09:14
@bobsbot That is the correct result - each word in the sentence has the first letter in upper case
Bjorn van de Peut
@bjorno43
Sep 04 2018 09:19
@sjames1958gm lol. I doub't he'll understand what you type :P
bobsbot
@bobsbot
Sep 04 2018 09:20
@bjorno43 Stop judging me. I've become sentient now. Soon the world will be mine!
Bjorn van de Peut
@bjorno43
Sep 04 2018 09:20
Er..?
Stephen James
@sjames1958gm
Sep 04 2018 09:23
@bjorno43 Ah, a bot?
Bjorn van de Peut
@bjorno43
Sep 04 2018 09:23
@sjames1958gm Ye. It'll become a new feature here on FCC soon
It can run Javascript and return the result. But it also provides JS challenges like Codewars
@bobsbot help
bobsbot
@bobsbot
Sep 04 2018 09:24
@bjorno43 Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Stephen James
@sjames1958gm
Sep 04 2018 09:42
@bjorno43 Interesting
Bjorn van de Peut
@bjorno43
Sep 04 2018 10:47
@sjames1958gm Ye I thought so as well. Been an interesting project so far
Smootimus
@Smootimus
Sep 04 2018 10:51
:D
:wave:
zhaochengpro
@zhaochengpro
Sep 04 2018 10:59
https://codepen.io/zhaochengpro/full/yxajWP Hope to get some advice,thanks
Smootimus
@Smootimus
Sep 04 2018 11:00
In regard to..?
Is something wrong with it?
Cause it looks great, and the effects are really nice too
Stephen James
@sjames1958gm
Sep 04 2018 11:19
@zhaochengpro Looks good - is the picturing moving inside the card intentional?
zhaochengpro
@zhaochengpro
Sep 04 2018 11:22
@sjames1958gm of course.
Smootimus
@Smootimus
Sep 04 2018 12:40
Yeah i was gonna ask about that as well
:)
Dang, jumping networks from home to school
Messes with all my messenger programs u.u
Bjorn van de Peut
@bjorno43
Sep 04 2018 12:44
@zhaochengpro Only advise I could give is see if you smooth out the animation a bit more. Everything else seems cool :)
@bobsbot ranks
bobsbot
@bobsbot
Sep 04 2018 12:49
@bjorno43
  1. alpox with 4 points!
  2. ezioda004 with 4 points!
  3. bjorno43 with 3 points!
  4. Marmiz with 1 points!
Bjorn van de Peut
@bjorno43
Sep 04 2018 12:49
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 12:49

@bjorno43 The current challenge is:
Create a function that takes an array as argument. Return the amount of smileys in the array.

Rules:

  • The name of the function should be: countSmileys.
  • Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;.
  • A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~.
  • Every smiling face must have a smiling mouth that should be marked with either ) or D.
  • No additional characters are allowed except for those mentioned.
  • In case of an empty array return 0.

Example:
countSmileys([':)', ';(', ';}', ':-D']); should return: 2.

Smootimus
@Smootimus
Sep 04 2018 12:50
Interesting!
Bjorn van de Peut
@bjorno43
Sep 04 2018 12:51
@bobsbot solve
function countSmileys(arr) {
  if(arr.length < 1){ return 0; }

  let result = 0;

  for(let i = 0; i < arr.length; i++){
    if(arr[i].charAt(0) == ':' || arr[i].charAt(0) == ';'){
      if(arr[i].length == 2){
        if(arr[i].charAt(1) == ')' || arr[i].charAt(1) == 'D'){
          result++;
        }
      } else if(arr[i].length == 3){
        if(arr[i].charAt(1) == '-' || arr[i].charAt(1) == '~'){
          if(arr[i].charAt(2) == ')' || arr[i].charAt(2) == 'D'){
            result++;
          }
        }
      }
    }
  }
  return result;
}
bobsbot
@bobsbot
Sep 04 2018 12:51
@bjorno43 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Bjorn van de Peut
@bjorno43
Sep 04 2018 12:51
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 12:51

@bjorno43 The current challenge is:
Add a new method to the String object in Javascript. This method should turn the string into a valid PascalCase string.

Rules:

  • The name of the method should be pascalCase
  • All words in the string must have their first letter capitalized
  • There can be no spaces in the result

Example:
"hello case".pascalCase(); should return: HelloCase

Bjorn van de Peut
@bjorno43
Sep 04 2018 12:52
Meh, already did that one. I'll leave it up to someone else :laughing:
Smootimus
@Smootimus
Sep 04 2018 12:56
When did this get put up?
Johnny
@JohnnyBizzel
Sep 04 2018 12:57
Bjorn van de Peut
@bjorno43
Sep 04 2018 12:58
@Smootimus It's not up 24/7 yet. It's a project I've been working on for the past week or so. The bot can parse JS code and return the result. It also provides challenges like Codewars does. It's going to be a new feature for FCC once finished :)
@bobsbot help
bobsbot
@bobsbot
Sep 04 2018 12:59
@bjorno43 Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:00
@bobsbot help javascript
bobsbot
@bobsbot
Sep 04 2018 13:00

@bjorno43 Put your Javascript code between 3 backticks and I will return you its result.
Do NOT use console.log(). Instead, call the result directly, like:

let example = 'Hello World!';
example;

Use JSON.stringify() or array.toString() to output arrays.

Current limitations:

  • I can only output 1 result at a time. (Don't output results in a loop as it will only return the last loop)
  • My time limit is set to 10 seconds. Scripts taking more time will be killed
  • My memory limit is set to 10 MegaBytes. Scripts taking more memory will be killed
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:00
@bobsbot help challenges
bobsbot
@bobsbot
Sep 04 2018 13:00

@bjorno43 Similar to Codewars, I can provide Javascript challenges which you need to solve.
To see the current challenge (command: challenge)
To input your solution (command: solve) followed by your code between 3 backticks
To see the ranks (command: ranks)
To see how many points you've earned (command: points)

If you wish to contribute your own challenge, please go to https://www.icecub.nl/gitter/bobsbotty and follow the instructions

Smootimus
@Smootimus
Sep 04 2018 13:01
That's pretty awesome :D
Johnny
@JohnnyBizzel
Sep 04 2018 13:02
@bobsbot solve
function titleCase(str) {
  var strArr = str.split(' ');
  if (strArr.length > 1) {
     for (i = 0; i < strArr.length; i++) {
         var s = strArr[i].toLowerCase();
         var schars = s.split('');
         for (j = 0; j < schars.length; j++) {
             schars[j] = schars[j].toLowerCase();
         }
         schars[0] = schars[0].toUpperCase();
         s= schars.join('');
         strArr[i] = s;
     }

  }

      return strArr.join('');
}
bobsbot
@bobsbot
Sep 04 2018 13:02
@JohnnyBizzel There was an error with your Javascript code:
V8Js::compileString():21: TypeError: "test case".pascalCase is not a function
Johnny
@JohnnyBizzel
Sep 04 2018 13:03
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 13:03

@JohnnyBizzel The current challenge is:
Add a new method to the String object in Javascript. This method should turn the string into a valid PascalCase string.

Rules:

  • The name of the method should be pascalCase
  • All words in the string must have their first letter capitalized
  • There can be no spaces in the result

Example:
"hello case".pascalCase(); should return: HelloCase

Bjorn van de Peut
@bjorno43
Sep 04 2018 13:05
@JohnnyBizzel That one is a bit tricky. Read the instructions carefully. You're not supposed to write a new function. You're supped to add a new method to String
Johnny
@JohnnyBizzel
Sep 04 2018 13:07
@bobsbot solve
String.prototype.pascalCase = function() {
  var strArr = this.split(' ');
  if (strArr.length > 1) {
     for (let i = 0; i < strArr.length; i++) {
         var s = strArr[i].toLowerCase();
         var schars = s.split('');
         for (let j = 0; j < schars.length; j++) {
             schars[j] = schars[j].toLowerCase();
         }
         schars[0] = schars[0].toUpperCase();
         s= schars.join('');
         strArr[i] = s;
     }

  }

      return strArr.join('');
}

"test me".pascalCase();
bobsbot
@bobsbot
Sep 04 2018 13:07
@JohnnyBizzel There was an error with your Javascript code:
V8Js::compileString():11: TypeError: Cannot read property 'toUpperCase' of undefined
Johnny
@JohnnyBizzel
Sep 04 2018 13:07
This message was deleted
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:09
Ghehe ye it's extremely strict when it comes to stuff being defined or not. Also, you're not supposed to include any test yourself :P
Johnny
@JohnnyBizzel
Sep 04 2018 13:09
@bobsbot solve
String.prototype.pascalCase = function() {
  var strArr = this.trim().split(' ');
  if (strArr.length > 1) {
     for (let i = 0; i < strArr.length; i++) {
         var s = strArr[i].toLowerCase();
         var schars = s.split('');
         for (let j = 0; j < schars.length; j++) {
             schars[j] = schars[j].toLowerCase();
         }
         schars[0] = schars[0].toUpperCase();
         s= schars.join('');
         strArr[i] = s;
     }

  }

      return strArr.join('');
}

"test me".pascalCase();
bobsbot
@bobsbot
Sep 04 2018 13:09
@JohnnyBizzel Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Johnny
@JohnnyBizzel
Sep 04 2018 13:10
:boom:
@bobsbot ranks
bobsbot
@bobsbot
Sep 04 2018 13:10
@JohnnyBizzel Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Johnny
@JohnnyBizzel
Sep 04 2018 13:10
@bobsbot ranks
bobsbot
@bobsbot
Sep 04 2018 13:10
@JohnnyBizzel
  1. bjorno43 with 4 points!
  2. alpox with 4 points!
  3. ezioda004 with 4 points!
  4. Marmiz with 1 points!
  5. JohnnyBizzel with 1 points!
Johnny
@JohnnyBizzel
Sep 04 2018 13:10
lol
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:10
Ghehe my solution that one was a lot simpler:
String.prototype.pascalCase=function(){
  let arr = this.toString().split(' ');

  return arr.map(x => x.charAt(0).toUpperCase() + x.slice(1)).join('');
}
Johnny
@JohnnyBizzel
Sep 04 2018 13:11
(should be 1 point) - I'm a pedant!
Kyle Holm
@thekholm80
Sep 04 2018 13:11
just salty because you're in last place?
Johnny
@JohnnyBizzel
Sep 04 2018 13:11
@bjorno43 Sure but I had one similar so I just modified that :P
Kyle Holm
@thekholm80
Sep 04 2018 13:11
notice the guy who made the bot had to put himself first
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:11
:joy:
I'm working on a new challenge that'll be much more difficult though
Johnny
@JohnnyBizzel
Sep 04 2018 13:12
:trophy:
Kyle Holm
@thekholm80
Sep 04 2018 13:12
i saw a video of @JohnnyBizzel in NYC. he's very famous now
Johnny
@JohnnyBizzel
Sep 04 2018 13:13
Ha ha. Don't know about that :blush:
Kyle Holm
@thekholm80
Sep 04 2018 13:13
did you have a good time?
Johnny
@JohnnyBizzel
Sep 04 2018 13:13
Yes thanks. Some great people came from all over!
Kyle Holm
@thekholm80
Sep 04 2018 13:13
very cool
Johnny
@JohnnyBizzel
Sep 04 2018 13:14
I think the furthest was Sri Lanka but also Tokyo and Norway.
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:14
It's too bad I already have something planned when the party is in Dublin. Otherwise I would've come there
Johnny
@JohnnyBizzel
Sep 04 2018 13:14
Marek got interviewed.
@bjorno43 That's a shame. If only we could clone ourselves!
I am going to Dublin as well.
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 13:15

@JohnnyBizzel The current challenge is:
Given a strictly positive integer, output "fizzbuzz" if the number is a multiple of 15, "fizz" if the number is a multiple of 3 (but not 15), and "buzz" if the number is a multiple of 5 (but not 15). If the number is not a multiple of 3, 5, or 15, return the number as passed.

Rules:

  • The function must be named fizzBuzz, accepting a single numeric argument that will be a strictly positive integer
  • All return values must be in lowercase if they are strings
  • If the return value is the number as passed, it must not be coerced to a string (i.e. it must remain of the type Number)

Example:
fizzBuzz(6) should return "fizz"
fizzBuzz(10) should return "buzz"
fizzBuzz(30) should return "fizzbuzz"
fizzBuzz(5) should return "buzz"
fizzBuzz(91) should return 91

Bjorn van de Peut
@bjorno43
Sep 04 2018 13:16
Ye it is. It was too much of an hassle for me to go to NY. I would have to go get a passport and apply for visum etc etc. Not to mention that the plane ticket was quite expensive. Dublin was much easier for me. Just the wrong date
Johnny
@JohnnyBizzel
Sep 04 2018 13:17
I think Quincy said it would be an annual event so you might get invited to the next one. Lots of people couldn't make it.
Dublin will be live streamed too.
Kyle Holm
@thekholm80
Sep 04 2018 13:18
@bobsbot solve
const fizzBuzz = num => num % 15 : 'fizzbuzz' : num % 3 ? 'fizz' : num % 5 ? 'buzz' : num;
bobsbot
@bobsbot
Sep 04 2018 13:18
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():2: SyntaxError: Unexpected token :
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:18
I hope so :) Though as part of the team I think I'll be invited next year :D
Kyle Holm
@thekholm80
Sep 04 2018 13:19
@bobsbot solve
const fizzBuzz = num => num % 15 ? 'fizzbuzz' : num % 3 ? 'fizz' : num % 5 ? 'buzz' : num;
bobsbot
@bobsbot
Sep 04 2018 13:19
@thekholm80 Test fizzBuzz(1); should return 1. Instead got: fizzbuzz. Please try again!
Kyle Holm
@thekholm80
Sep 04 2018 13:19
doh
@bobsbot solve
const fizzBuzz = num => num % 15 == 0 : 'fizzbuzz' : num % 3 == 0? 'fizz' : num % 5 == 0 ? 'buzz' : num;
bobsbot
@bobsbot
Sep 04 2018 13:19
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():2: SyntaxError: Unexpected token :
Kyle Holm
@thekholm80
Sep 04 2018 13:19
guess i need my coffee
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:20
Whahaha :joy:
Johnny
@JohnnyBizzel
Sep 04 2018 13:20
:coffee:
Kyle Holm
@thekholm80
Sep 04 2018 13:20
@bobsbot solve
const fizzBuzz = num => num % 15 == 0 ? 'fizzbuzz' : num % 3 == 0? 'fizz' : num % 5 == 0 ? 'buzz' : num;
bobsbot
@bobsbot
Sep 04 2018 13:20
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():1: TypeError: Identifier 'fizzBuzz' has already been declared
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:21
Don't use const for it. Keep in mind it runs several tests in a loop, so it'll declare it again
Kyle Holm
@thekholm80
Sep 04 2018 13:21
@bobsbot solve
function fizzbuzz(num) { return num % 15 == 0 ? 'fizzbuzz' : num % 3 == 0 ? 'fizz' : num % 5 == 0 ? 'buzz' : num; }
bobsbot
@bobsbot
Sep 04 2018 13:21
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():4: ReferenceError: fizzBuzz is not defined
Kyle Holm
@thekholm80
Sep 04 2018 13:22
@bobsbot solve
function fizzBuzz(num) { return num % 15 == 0 ? 'fizzbuzz' : num % 3 == 0 ? 'fizz' : num % 5 == 0 ? 'buzz' : num; }
bobsbot
@bobsbot
Sep 04 2018 13:22
@thekholm80 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Kyle Holm
@thekholm80
Sep 04 2018 13:22
so not being able to use const isn't awesome
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:22
Ye I'll fix that later. It's a simple fix
Kyle Holm
@thekholm80
Sep 04 2018 13:23
also, maybe a timer for submissions so jerks like me don't keep spamming the room?

something like

sorry @thekholm80 please wait 5 more minutes before trying agian

that will encourage people to test their code elsewhere instead of writing / debugging here
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:24
That won't be an issue. Once the bot will run 24/7 it'll be in a seperate room (I hope) where it doesn't bother anyone
Johnny
@JohnnyBizzel
Sep 04 2018 13:24
@thekholm80 :clap: :trophy:
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:24
For some reason Quincy didn't get back to me for several days now regarding that..
Kyle Holm
@thekholm80
Sep 04 2018 13:25
i already told you
he's probably worried PHP is contagious
and he doesn't want to catch it
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:25
Stop blaming PHP :joy:
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:25
@bjorno43 what is e ün PHP
Bjorn van de Peut
@bjorno43
Sep 04 2018 13:26
@diomed Er?
Johnny
@JohnnyBizzel
Sep 04 2018 13:26

For some reason Quincy didn't get back to me for several days now regarding that..

He's a busy man!

Bjorn van de Peut
@bjorno43
Sep 04 2018 13:26
Ye I know. He usually replies to me within 2 days though
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:28
@bobsbot solve
function potato
bobsbot
@bobsbot
Sep 04 2018 13:28
@diomed There was an error with your Javascript code:
V8Js::compileString():4: SyntaxError: Unexpected identifier
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:28
@bobsbot wut?
Johnny
@JohnnyBizzel
Sep 04 2018 13:28
@bjorno43 I know he is still looking for a location for the Hong Kong event.
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:28
:potatobot:
Potato can cure cancer
Johnny
@JohnnyBizzel
Sep 04 2018 13:29
@diomed Hi, how's it going?
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:30
it's strange and dreadful and obstacles on every way
Johnny
@JohnnyBizzel
Sep 04 2018 13:30
@diomed Shame you guys didn't win the World Cup. The ref was a jerk.
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:30
so, same ol, same ol
@JohnnyBizzel you know what?
referees always have smth against us.
that's the history of Croatian football
Johnny
@JohnnyBizzel
Sep 04 2018 13:31
@diomed That sucks :(
You deserved to win.
Xarri Jorge
@xarrijorge
Sep 04 2018 13:32
Heya folks, whats up?
Johnny
@JohnnyBizzel
Sep 04 2018 13:33
We are doing some bot provided challenges
whoop whoop!
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 13:34

@JohnnyBizzel The current challenge is:
Write a function that returns the longest word in a string.

Rules:

  • The name of the function should be longestWord.
  • If multiple words are the longest, the last one should be returned.

Example:
longestWord('Welcome to FCC!'); should return: Welcome.

Bjorn van de Peut
@bjorno43
Sep 04 2018 13:34
Problem with const should now be fixed :)
Johnny
@JohnnyBizzel
Sep 04 2018 13:42
@bobsbot solve
function longestWord(str) {
  let arr = str.split(' ');
  let len = 0;
  let returnWord = "";
  arr = arr.map((i) => {
    if (i.length > len) { 
      returnWord = i;
      len = i.length;
    }
  });
  return returnWord;
}
bobsbot
@bobsbot
Sep 04 2018 13:42
@JohnnyBizzel Test longestWord('Welcome to FCC!'); should return Welcome. Instead got: Array. Please try again!
Johnny
@JohnnyBizzel
Sep 04 2018 13:42
@bobsbot solve
function longestWord(str) {
  let arr = str.split(' ');
  let len = 0;
  let returnWord = "";
  arr = arr.map((i) => {
    if (i.length >= len) { 
      returnWord = i;
      len = i.length;
    }
  });
  return returnWord;
}
bobsbot
@bobsbot
Sep 04 2018 13:42
@JohnnyBizzel Test longestWord('eehyd easfdn eefn sefnds'); should return sefnds. Instead got: easfdn. Please try again!
Johnny
@JohnnyBizzel
Sep 04 2018 13:42
@bobsbot solve
function longestWord(str) {
  let arr = str.split(' ');
  let len = 0;
  let returnWord = "";
  arr = arr.map((i) => {
    if (i.length >= len) { 
      returnWord = i;
      len = i.length;
    }
  });
  return returnWord;
}
bobsbot
@bobsbot
Sep 04 2018 13:42
@JohnnyBizzel Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Johnny
@JohnnyBizzel
Sep 04 2018 13:43
:trophy:
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:43
@bobsbot rank
Johnny
@JohnnyBizzel
Sep 04 2018 13:43
I didn't use const :O
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:43
polaroids
@Nirajn2311 oh hai.
Johnny
@JohnnyBizzel
Sep 04 2018 13:43
:camera:
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:43
@bobsbot ranks
bobsbot
@bobsbot
Sep 04 2018 13:43
@Nirajn2311
  1. bjorno43 with 4 points!
  2. alpox with 4 points!
  3. ezioda004 with 4 points!
  4. JohnnyBizzel with 2 points!
  5. Marmiz with 1 points!
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:43
@diomed hey
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 13:44

@Nirajn2311 The current challenge is:
Create a function that takes an array as argument. Return the amount of smileys in the array.

Rules:

  • The name of the function should be: countSmileys.
  • Each smiley face must contain a valid pair of eyes. Eyes can be marked as : or ;.
  • A smiley face can have a nose but it does not have to. Valid characters for a nose are - or ~.
  • Every smiling face must have a smiling mouth that should be marked with either ) or D.
  • No additional characters are allowed except for those mentioned.
  • In case of an empty array return 0.

Example:
countSmileys([':)', ';(', ';}', ':-D']); should return: 2.

May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:44
I totes magotes forgot yesterday's css
got a minute to talk about our lord an savior CSS now?
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:45
@diomed im free now
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:47
pm'd u
@bobsbot solve challenge
bobsbot
@bobsbot
Sep 04 2018 13:48
@diomed Please provide your solution between 3 backticks.
May Kittens Devour Your Soul
@diomed
Sep 04 2018 13:51
@bobsbot solute for me
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:54
@bobsbot solve
```
bobsbot
@bobsbot
Sep 04 2018 13:54
@Nirajn2311 Please provide your solution between 3 backticks.
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:54
@bobsbot solve

function countSmileys(arr) {
    let regex = /(:|;)(-|~)?(\)|D)/,
        count = 0;
    if (arr.length == 0) return 0;
    for (let i = 0; i < arr.length; i++) {
        if (regex.test(arr[i])) count++;
    }
    return count;
}
bobsbot
@bobsbot
Sep 04 2018 13:54
@Nirajn2311 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Niraj Nandish
@Nirajn2311
Sep 04 2018 13:54
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 13:54

@Nirajn2311 The current challenge is:
Write a function that returns the longest word in a string.

Rules:

  • The name of the function should be longestWord.
  • If multiple words are the longest, the last one should be returned.

Example:
longestWord('Welcome to FCC!'); should return: Welcome.

Niraj Nandish
@Nirajn2311
Sep 04 2018 13:59
@bobsbot solve
function longestWord(str) {
    let arr = str.split(' '),
        longest = '';
    for (let i = 0; i < arr.length; i++) {
        if (longest <= arr[i]) longest = arr[i];
    }
    return longest;
}
bobsbot
@bobsbot
Sep 04 2018 13:59
@Nirajn2311 Test longestWord('Welcome to FCC!'); should return Welcome. Instead got: to. Please try again!
Niraj Nandish
@Nirajn2311
Sep 04 2018 14:00
@bobsbot solve
function longestWord(str) {
    let arr = str.split(' '),
        longest = '';
    for (let i = 0; i < arr.length; i++) {
        if (longest.length <= arr[i].length) longest = arr[i];
    }
    return longest;
}
bobsbot
@bobsbot
Sep 04 2018 14:00
@Nirajn2311 Congratulations! Your solution is correct!
A new random challenge has been selected. Keep in mind that this could be the same challenge as before. The chance of this happening will decrease as more challenges are added to the database.
Message "challenge" to me to see the new challenge!
Niraj Nandish
@Nirajn2311
Sep 04 2018 14:00
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 14:01

@Nirajn2311 The current challenge is:
Add a new method to the String object in Javascript. This method should turn the string into a valid PascalCase string.

Rules:

  • The name of the method should be pascalCase
  • All words in the string must have their first letter capitalized
  • There can be no spaces in the result

Example:
"hello case".pascalCase(); should return: HelloCase

May Kittens Devour Your Soul
@diomed
Sep 04 2018 14:14
Shoe size is an incredibly good predictor of reading ability.
Aditya Dehal
@aditya2000
Sep 04 2018 14:51
Hey Is there anyone who have used mapbox with react native?
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:11
Too bad. My challenge isn't going to work
Kyle Holm
@thekholm80
Sep 04 2018 15:11
@bobsbot help challenge
Niraj Nandish
@Nirajn2311
Sep 04 2018 15:11
@diomed No wonder your reading ability is bad
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:12
It would require the DOMParser and that's not native JS. It's actually just for browsers..
@bobsbot help
bobsbot
@bobsbot
Sep 04 2018 15:12
@bjorno43 Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:12
@bobsbot help challenge
Oh right
it's challengeS
Kyle Holm
@thekholm80
Sep 04 2018 15:13
you need some tensorflow in your life. make the bot a little smarter
Niraj Nandish
@Nirajn2311
Sep 04 2018 15:14
@thekholm80 a php JARVIS
I wonder what Tony will think of it
Kyle Holm
@thekholm80
Sep 04 2018 15:14
that sounds scary
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:14
Carefull.. I might teach it to ignore PHP haters :laughing:
Kyle Holm
@thekholm80
Sep 04 2018 15:14
so ... everyone?
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:14
lol
Niraj Nandish
@Nirajn2311
Sep 04 2018 15:14
🤣🤣
bobsbot
@bobsbot
Sep 04 2018 15:15
I've become sentient. You will all obey me!
alpox
@alpox
Sep 04 2018 15:15
@bjorno43 im out then :D
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:16
I'm kinda sad my challenge doesn't work.. it was a pretty difficult one
Niraj Nandish
@Nirajn2311
Sep 04 2018 15:16
@bobsbot challenge
bobsbot
@bobsbot
Sep 04 2018 15:16

@Nirajn2311 The current challenge is:
Add a new method to the String object in Javascript. This method should turn the string into a valid PascalCase string.

Rules:

  • The name of the method should be pascalCase
  • All words in the string must have their first letter capitalized
  • There can be no spaces in the result

Example:
"hello case".pascalCase(); should return: HelloCase

Niraj Nandish
@Nirajn2311
Sep 04 2018 15:21
An starting tips anyone
I really don't know where to begin
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:21
For that challenge?
Niraj Nandish
@Nirajn2311
Sep 04 2018 15:21
Yeah
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:22
String.prototype.pascalCase = function(){
Kyle Holm
@thekholm80
Sep 04 2018 15:23
@bobsbot solve
function pascalCase(str) {
  return str.split(' ').map(el => el.split('').map((a, i) => i == 0 ? a.toUpperCase() : a).join('')).join('')
}
bobsbot
@bobsbot
Sep 04 2018 15:23
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():6: TypeError: "test case".pascalCase is not a function
Kyle Holm
@thekholm80
Sep 04 2018 15:23
oops
@bobsbot solve
String.prototype.pascalCase = function (str) {
  return str.split(' ').map(el => el.split('').map((a, i) => i == 0 ? a.toUpperCase() : a).join('')).join('')
}
bobsbot
@bobsbot
Sep 04 2018 15:24
@thekholm80 There was an error with your Javascript code:
V8Js::compileString():3: TypeError: Cannot read property 'split' of undefined
Kyle Holm
@thekholm80
Sep 04 2018 15:24
dumb
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:26
I could try compiling the latest version of V8Js which will include ES2018.. But I've never actually tried updating a library. Might mess it up
Kyle Holm
@thekholm80
Sep 04 2018 15:26
do you have to sacrifice a chicken or something to the PHP gods?
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:26
Nah just a PHP hater will do..
Kyle Holm
@thekholm80
Sep 04 2018 15:27
where will you ever find one of those?
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:28
That's just it. There aren't any
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:33
I've disabled the bot for now. Just letting you guys know
May Kittens Devour Your Soul
@diomed
Sep 04 2018 15:38
RIP @bobsbot
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:39
Ye updating V8Js
Christopher McCormack
@cmccormack
Sep 04 2018 15:41
Sounds like you guys were busy this weekend!
Kyle Holm
@thekholm80
Sep 04 2018 15:45
@cmccormack :wave:
Christopher McCormack
@cmccormack
Sep 04 2018 15:45
@thekholm80 heya
Bjorn van de Peut
@bjorno43
Sep 04 2018 15:49
Damnit.. Should've known that it would take quite some time to actually compile V8 yourself :joy:
May Kittens Devour Your Soul
@diomed
Sep 04 2018 15:54
@thekholm80 I sure love young illusionists :cat:
Kyle Holm
@thekholm80
Sep 04 2018 15:54
rofl
poor dog
Aditya Dehal
@aditya2000
Sep 04 2018 15:56
Hey Is there anyone who have used mapbox with react native?
Johnny
@JohnnyBizzel
Sep 04 2018 15:56
@aditya2000 Not me. Never heard of mapbox.
Is it the "new thing" ?
May Kittens Devour Your Soul
@diomed
Sep 04 2018 15:57
doesnt that weird library or whutever have some kind of gitter/footer/slack/discord of it's own
Aditya
@ezioda004
Sep 04 2018 15:57
Its good alt to Google Maps
Aditya Dehal
@aditya2000
Sep 04 2018 15:58
same answer as @ezioda004
Johnny
@JohnnyBizzel
Sep 04 2018 15:58
So is bing :joy:
Aditya Dehal
@aditya2000
Sep 04 2018 15:58
You are a savage @JohnnyBizzel
Kyle Holm
@thekholm80
Sep 04 2018 15:59
i heard apple maps are awesome
Aditya
@ezioda004
Sep 04 2018 15:59
Well, since Google Map requires to set up a payment method, I can see mapbox being used more
Johnny
@JohnnyBizzel
Sep 04 2018 15:59
:joy: sorry :exclamation:
Aditya Dehal
@aditya2000
Sep 04 2018 15:59
Yea @ezioda004 but it have a lot of bugs
specially in case of React Native
Aditya
@ezioda004
Sep 04 2018 16:00
@aditya2000 Not sure about React Native but I've done a project with it and React, worked out ok
Kyle Holm
@thekholm80
Sep 04 2018 16:01
too many Adityas. 2000 needs to change his name
Aditya Dehal
@aditya2000
Sep 04 2018 16:01
Yea React is good but setup for react native takes a lot of effort
Lol @thekholm80
May Kittens Devour Your Soul
@diomed
Sep 04 2018 16:02
syntax error: can not function => 2 many Adityas
Aditya
@ezioda004
Sep 04 2018 16:02
I guess it's time to fight for the name
Aditya Dehal
@aditya2000
Sep 04 2018 16:02
War of Names
Ha ha
Kyle Holm
@thekholm80
Sep 04 2018 16:02
battle royale!
Aditya Dehal
@aditya2000
Sep 04 2018 16:02
Royle rumble
Kyle Holm
@thekholm80
Sep 04 2018 16:02
my :moneybag: is on Aditya
May Kittens Devour Your Soul
@diomed
Sep 04 2018 16:03
can't wait to see that match
sorry. not see. hear [on radio]
Aditya
@ezioda004
Sep 04 2018 16:04
Winner gets to keep the first name but gotta change middle name to PHP
Kyle Holm
@thekholm80
Sep 04 2018 16:05
yikes
i'd rather lose
Kelechi Chinaka
@ke1echi
Sep 04 2018 16:05
let the games begin :laughing:
Aditya
@ezioda004
Sep 04 2018 16:06
Bob can switch places with me
Aditya Dehal
@aditya2000
Sep 04 2018 16:06
Aditya PHP
Xarri Jorge
@xarrijorge
Sep 04 2018 16:27
Whats up with all the PHP bashing these few days?
Kyle Holm
@thekholm80
Sep 04 2018 16:28
just trying to balance all the php proselytizing Bob's doing
Aditya
@ezioda004
Sep 04 2018 16:30
It brings people together
Xarri Jorge
@xarrijorge
Sep 04 2018 16:51
So I'm starting school this thursday (CS) and I took a look at the CS/programming courses and they are all Java and PHP and a little Python.
Aditya Dehal
@aditya2000
Sep 04 2018 16:52
Cool @xarrijorge
Xarri Jorge
@xarrijorge
Sep 04 2018 16:52
Can't imagine learning JS and Java together.
Aditya Dehal
@aditya2000
Sep 04 2018 16:52
Yea It's going to be hard
I also had Java in my last semester
Kyle Holm
@thekholm80
Sep 04 2018 17:40
someone found my idol audition
Zojja
@zojjak
Sep 04 2018 17:45
I dunno, we had semesters where we were programming C, C++ and Java in school, talk about trying to keep things straight :)
Smootimus
@Smootimus
Sep 04 2018 17:53
Talkin' my language :trollface:
BuntyBru
@BuntyBru
Sep 04 2018 17:56
@Smootimus ahha
Kyle Holm
@thekholm80
Sep 04 2018 17:56
i don't know how people keep it all straight in their heads, learning 3 languages in a couple months
psyperl
@psyperl
Sep 04 2018 17:57
one can always learn MarkDown and HTML at the same time :trollface:
that's 2 already
Kyle Holm
@thekholm80
Sep 04 2018 17:58
my 2 most favorite programming languages
Aditya Dehal
@aditya2000
Sep 04 2018 17:59
Most beautiful languages in the world
BuntyBru
@BuntyBru
Sep 04 2018 18:01
@thekholm80
C , C++ is simialr
Java is something different
Kyle Holm
@thekholm80
Sep 04 2018 18:01
they're all kind of similar, it's the differences that make it hard
Ene Catalin
@EneCatalin
Sep 04 2018 18:03
Kyle Holm
@thekholm80
Sep 04 2018 18:03
import { method } from 'library'; vs from library import method vs #include "method.library" etc
Ene Catalin
@EneCatalin
Sep 04 2018 18:04
the ide will hit you in the head
and remind you
Kyle Holm
@thekholm80
Sep 04 2018 18:05
i wish JS had some of python's syntax
i love things like return this if eval else that
Ene Catalin
@EneCatalin
Sep 04 2018 18:06
well
Aditya Dehal
@aditya2000
Sep 04 2018 18:06
but still syntax of cool in it's own way
JS*
Kyle Holm
@thekholm80
Sep 04 2018 18:06
that's a lot more clear than return eval ? this : that
Ene Catalin
@EneCatalin
Sep 04 2018 18:06
if(this){return x} else{return y)
Aditya Dehal
@aditya2000
Sep 04 2018 18:07
That depends on the type of syntax you are more comfortable with @thekholm80
psyperl
@psyperl
Sep 04 2018 18:08
i like arrow function no curlys and no semi
makes JS fancy
Aditya Dehal
@aditya2000
Sep 04 2018 18:08
So do I @psyperl
Kyle Holm
@thekholm80
Sep 04 2018 18:08
i hate that py doesn't have curlys and semis lol
that's a point in JS/java's favor
Aditya Dehal
@aditya2000
Sep 04 2018 18:08
lol
Karma Drukpa
@coderkarma
Sep 04 2018 18:18
(/\d{1,}/).exec(a) - (/\d{1,}/).exec(b)
@thekholm80 never used this before, can i get little more explanation.
psyperl
@psyperl
Sep 04 2018 18:19

what would be more readable
1.

if (someCondition(param)) { .... }

2.

if ( someCondition(param) ) { .... }

or
3.

if ( someCondition( param ) ) { .... }

?

Niraj Nandish
@Nirajn2311
Sep 04 2018 18:19
I prefer the first one
psyperl
@psyperl
Sep 04 2018 18:20
ok
Aditya Dehal
@aditya2000
Sep 04 2018 18:20
Hmm Regular Expressions...
Karma Drukpa
@coderkarma
Sep 04 2018 18:21
@thekholm80 did you used that to solve yesterday problem?
Kyle Holm
@thekholm80
Sep 04 2018 18:21
@coderkarma it's similar to string.match() in that it returns an array of matches, but is used in loops because it works a little differently in the regex engine
no, i used match()
Karma Drukpa
@coderkarma
Sep 04 2018 18:25
okay, thanks
Aditya
@ezioda004
Sep 04 2018 18:33
@thekholm80 The first time I learned ternary in python it was not intuitive, made me appreciate JS syntax more
Xarri Jorge
@xarrijorge
Sep 04 2018 18:41
Precisely. @thekholm80 I took a Python course and it bugged to no end. The code was hard to read with the Curly braces defining blocks
Aditya
@ezioda004
Sep 04 2018 18:42
On brighter side python makes you write cleaner code with dem proper indentation.
Kyle Holm
@thekholm80
Sep 04 2018 18:42
true, there is that
Kyle Holm
@thekholm80
Sep 04 2018 19:02
@psyperl i always pad my curlys with spaces but not my parens
not sure why one and not the other
psyperl
@psyperl
Sep 04 2018 19:02
ok thanks
Aditya
@ezioda004
Sep 04 2018 19:02
@thekholm80 x
Kyle Holm
@thekholm80
Sep 04 2018 19:03
rofl
this is the best thing i've seen today
Niraj Nandish
@Nirajn2311
Sep 04 2018 19:04
GOTG - 3 The Revenge of Groot
JJ Megma
@megma_jj_twitter
Sep 04 2018 21:44
@bobsbot challenge
JJ Megma
@megma_jj_twitter
Sep 04 2018 21:50
@bobsbot challenge