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
Piyush Tiwari
@piyush805
There is array[num] is doesnt work^
teevik
@teevik
The array[num] is just a standard object
so array[num].key gives the value for that key
Piyush Tiwari
@piyush805
$(".message").html(JSON.stringify(json));
There was this which was returning entire page on click
Nastya
@a4evo
@piyush805 don't you need to generate that num first? and what is array?
teevik
@teevik
Json.stringify turns an object into a string
Piyush Tiwari
@piyush805
@teevik I only know what all I learnt from challenges :worried:
Nastya
@a4evo
$(".message").html(json[0]); try this
Piyush Tiwari
@piyush805
@a4evo I generated number and array in Javascript panel
Nastya
@a4evo
@piyush805 the num should be generated on click, as i understand. And you don't need a new array, json you get is already an array
Piyush Tiwari
@piyush805
teevik
@teevik
Why do you fetch it twice?
Once in html and once in js
Piyush Tiwari
@piyush805
@teevik Exactly! See, the click event happens in js and random number is generated in Html. I am not able to connect the two via code
teevik
@teevik
You can just run all the code in js part, no difference
Piyush Tiwari
@piyush805
https://stackoverflow.com/questions/14540248/how-to-get-an-array-javascript-of-json-file In this link i found how to get json file into an array to work with in html
Nastya
@a4evo
sorry, use it $(".message").html(JSON.stringify(json[0])); and delete everything in <script> in html part
Piyush Tiwari
@piyush805
@a4evo $(".message").html(json[0]); is not fetching object from json. Only printing the code for random number from inside div with id=message
Nastya
@a4evo
it's just to have a look what's inside
teevik
@teevik
The stackoverflow shows how to turn an object into array
You allready get an array in the json
Nastya
@a4evo
$(".message").html(json[0].quote);
@piyush805 read more about arrays and objects
Piyush Tiwari
@piyush805
@a4evo the previous one with stringify looked more correct but this ^ and that, both doing nothing.
Yeah :/
teevik
@teevik
Yeah, you should read up on all the basic concepts
Did stringify work?
Piyush Tiwari
@piyush805
@teevik no
Nastya
@a4evo
@piyush805 i changed that in your codepen, and it works
teevik
@teevik
Make sure you $.getJSON works
Ah
Piyush Tiwari
@piyush805
@a4evo It's working
Nastya
@a4evo
@piyush805 i know ))
Piyush Tiwari
@piyush805
What about random number code?
Nastya
@a4evo
just change 0 to random number @piyush805
Piyush Tiwari
@piyush805
@a4evo @teevik Thank you so much! :smile: I'll read more
CamperBot
@camperbot
piyush805 sends brownie points to @a4evo and @teevik :sparkles: :thumbsup: :sparkles:
:cookie: 134 | @teevik |http://www.freecodecamp.com/teevik
:cookie: 263 | @a4evo |http://www.freecodecamp.com/a4evo
Nastya
@a4evo
@piyush805 good luck!
teevik
@teevik
Lol, sorry for being confusing
Piyush Tiwari
@piyush805
@teevik not at all
teevik
@teevik
At phone
Piyush Tiwari
@piyush805
Is doing challenges on phone very difficult? For a few days I've to go out and I don't want to break the streak
@teevik
rishabh81
@rishabh81
Hi can someone help me understanding recompose library for hoc in react
cumibulat
@cumibulat
hi all, i'm struggling in finishing the random quote machine.. i can complete the function / logic part, but i'm having hard time in the design part.. i still cannot figure out how to make a box and centre it in the page..
rishabh81
@rishabh81
Are you using flexbox
??