Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
Activity
• Aug 17 09:32
• 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
Javier Pons
@JavierPons
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
Kaz Baig
@kbaig
Am I misunderstanding
Javier Pons
@JavierPons
@kbaig I dont know
if it year 45?
or 2003
Gersho
@Gersho
year/100 rounded up ?
Kaz Baig
@kbaig
aRtoo
@artoodeeto
@kbaig thanks bro mwah
CamperBot
@camperbot
artoodeeto sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
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
Gersho
@Gersho
it's ok we're all learning
Javier Pons
@JavierPons
@kbaig @Gersho thanks
CamperBot
@camperbot
javierpons sends brownie points to @kbaig and @gersho :sparkles: :thumbsup: :sparkles:
Javier Pons
@JavierPons
@Gersho @kbaig I think this is the way to learn. Do you agree with me, or you have an other interesting opinion?
Gersho
@Gersho
what are you refering to ?
Kaz Baig
@kbaig
Not sure what you mean
Javier Pons
@JavierPons
to make kata and ask here when you are stuck. I dont know other way to learn. I can't know every method at the moment and how to resolve the problems. For now I have quite limited way to resolve them
Gersho
@Gersho
kata ? oh you're from codewars then ? did you takes the lessons given here ?
Javier Pons
@JavierPons
yes
Kaz Baig
@kbaig
I think doing the freecodecamp algorithms are a good place since they give you some suggested methods to use
Javier Pons
@JavierPons
and in other places