Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 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
Kaz Baig
@kbaig
it will be ['1', '2', '3'], which you could map with the number function
Lee
@LeeConnelly12
@mhesham32 The function above will give you [1, 2, 3]
Kaz Baig
@kbaig
@LeeConnelly12 that will still do ['1', '2', '3']
Lee
@LeeConnelly12
@kbaig Isn't that what he wants?
Mostafa Hesham
@mhesham32
@LeeConnelly12 it still ["1", "2", "3"]
Kaz Baig
@kbaig
he wants them to be numbers, not strings
Lee
@LeeConnelly12
oh
@mhesham32
fun = (number) => {
return (number+'').split``.map(x => x/1) // [1, 2 , 3]
}
Kaz Baig
@kbaig
arg.toString().split('').map(n => Number(n))
Lee
@LeeConnelly12
@mhesham32 There you go
dividing a string by 1 will convert it to an integer
Kaz Baig
@kbaig
that's so hacky
Lee
@LeeConnelly12
not really
Mostafa Hesham
@mhesham32
@LeeConnelly12 it works thanks
CamperBot
@camperbot
mhesham32 sends brownie points to @leeconnelly12 :sparkles: :thumbsup: :sparkles:
:cookie: 158 | @leeconnelly12 |http://www.freecodecamp.com/leeconnelly12
Jose Diaz
@jsd540
@LeeConnelly12 Just made the change to the body. Thanks
CamperBot
@camperbot
jsd540 sends brownie points to @leeconnelly12 :sparkles: :thumbsup: :sparkles:
api offline
Mostafa Hesham
@mhesham32
i figured it out javascript deals with string numbers like numbers when math is done is that right? @LeeConnelly12
Kaz Baig
@kbaig
it does but you gotta be careful with that stuff
Lee
@LeeConnelly12
@mhesham32 Yeah
Mostafa Hesham
@mhesham32
it is weird actually
Lee
@LeeConnelly12
yeah stuff like this works
'2' * 2 // 4
Ashwin
@ashwins93
@mhesham32 it's actually in the official ecma specification. The ToNumber coercion. It's in the section 9.3 I guess
Or you could read about it in YDKJS
book 4 chapter 4
Isaiah Trembley
@IsaiahCT
@ashwins93 what is that
Ashwin
@ashwins93
@IsaiahCT what is what ? Lol
Mostafa Hesham
@mhesham32
@ashwins93 that is so nerdy :smile:
Isaiah Trembley
@IsaiahCT
YDKJS
Ashwin
@ashwins93
@mhesham32 lol yeah but knowing stuff like that can save you sometimes ( I meant knowing about the ToNumber not section numbers lol)
@IsaiahCT it's an amazing book. Check it out once you get some experience in JS
Mostafa Hesham
@mhesham32
sure thing thank you guys
mbpiner
@mbpiner
Hey guys, trying to access a certain object in a JSON for the wiki search project
For example, this is the URL which I'm trying to get this right with
It's a search for the term "philosophy" with callback=? at the end to request the JSON and JSONP
&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=philosophy&callback=?
is good for looking at it in an easier to read format
my problem is I have to get to the data which is at jsonData["query"]["pages"]
Kaz Baig
@kbaig
@mbpiner can you link the api call you're making or a pen
mbpiner
@mbpiner
Oops, sorry thought above was
Kaz Baig
@kbaig
full call
mbpiner
@mbpiner
at jsonData["query"]["pages"], the next element I have to select by to get further in the object is a random ass number
and jsonData["query"]["pages"][0] returns undefined so I cant call it by that
is there a jquery method or some library or something I can use to just return the first child, that would function similarly to jsonData["query"]["pages"][0]?
mbpiner
@mbpiner
I've googled around but i've realized after you and alpox helping me its a lot quicker just to ask someone who knows