Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Joy
@Yorokobi05
oh, I forgot to replace it.
It's working! Thanks a bunch @sjames1958gm !
CamperBot
@camperbot
yorokobi05 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8864 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
:+1:
@Yorokobi05 BTW functions are called left to right so the () around the toLowerCase() call are not needed
var z = arr[1].toLowerCase().split("");
Joy
@Yorokobi05
I see. Thanks @sjames1958gm ! I'll take note of that! :smile:
zipquote
@zipquote
This message was deleted
Javier Pons
@JavierPons
hi folks!
I have typed this code
function centuryFromYear(year) {
    if (year <= 100) {
        return '1';
    }else if (year > 101 && year <= 200) {
        return '2';
    }else if (year > 201 && year <= 300) {
        return '3';
    }else if (year > 301 && year <= 400) {
        return '4';
    }else if (year > 401 && year <= 500) {
        return '5';
    }else if ( year > 501 && year <= 600) {
        return '6';
    }else if ( year > 601 && year <= 700) {
        return '7';
..... and carry on.....
sure that its possible to type it in shorter way. Any advise?
Kaz Baig
@kbaig
@JavierPons
function centuryFromYear(year) {
  return Math.ceil(year / 100);
}
assuming you actually wanted year >= 101 to be 2 rather than year > 101
Though shouldn't it be < 100 returning 1, <= 200 && >= 100 returning 2 etc
In which case, it would be
function centuryFromYear(year) {
  return Math.floor(year / 100) + 1;
}
Javier Pons
@JavierPons
@kbaig Given a year, return the century it is in. That is the purpose
Kaz Baig
@kbaig
Right, but < year 100 is the first century
Year 100 is in the second century, no?
Javier Pons
@JavierPons
in this case we count 100 inside 1 century
Kaz Baig
@kbaig
Oh I'm mistaken, 100 is part of the 1st century
kk Math.ceil(year / 100) it is then
Javier Pons
@JavierPons
@kbaig no, it doesn't work
Kaz Baig
@kbaig
What case is it not satisfying?
Javier Pons
@JavierPons
anyone
:worried:
aRtoo
@artoodeeto
hello fam. i have a question? how can i make my modal center in my tictactoe game while it changes screen size? the game is done but i want to style it more. thanks. heres the pen. https://codepen.io/artoo/pen/Zvomxr?editors=0100
Am I misunderstanding
Javier Pons
@JavierPons
@kbaig I dont know
if it year 45?
or 2003
Gersho
@Gersho
year/100 rounded up ?
aRtoo
@artoodeeto
@kbaig thanks bro mwah
CamperBot
@camperbot
artoodeeto sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 529 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
@JavierPons https://gyazo.com/d3d7b38777b9a7ba0fbbffa313098493 works fine for those cases
Javier Pons
@JavierPons
function centuryFromYear(year) {
    Math.ceil(year / 100);
}
Gersho
@Gersho
return ?
Kaz Baig
@kbaig
you're not returning anything
Javier Pons
@JavierPons
yes
I find it out
sorry
:smile:
Gersho
@Gersho
not returning, is like asking someone to do some maths then throw away the paper
Javier Pons
@JavierPons
now it works
sorry my head
Gersho
@Gersho
it's ok we're all learning
Javier Pons
@JavierPons
@kbaig @Gersho thanks