Skip to content

Instantly share code, notes, and snippets.

@felipefunes
Last active March 13, 2019 19:21
Show Gist options
  • Save felipefunes/3e1379ead380f8b30657ea7a9fb97ed8 to your computer and use it in GitHub Desktop.
Save felipefunes/3e1379ead380f8b30657ea7a9fb97ed8 to your computer and use it in GitHub Desktop.
Simple JavaScript Test
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScrip Test</title>
</head>
<body>
<div id="app"></div>
<script>
/*
Please put inside the div with id 'app' the last 5 posts (ordered by id)
from this endpoint https://jsonplaceholder.typicode.com/posts
Add to the DOM items with each post showing title and body.
2. Add a button at the bottom of each post with the text "Show last comments",
which on click load the last 3 comments for this posts between the current post and the next one.
Please request comments just when it's needed. Here is the endpoint with the comments:
https://jsonplaceholder.typicode.com/comments
3. Include a console.error if any request returns an error.
4. About styles, don't think about look & feel, but set the div with id 'app' centered vertical and horizontal
to the window with a max-width of 320px. Besides, use an space between posts and diferenciate the font for titles and body text.
Please use ES6. Besides, you are allowed to use Angular, React or Vue, but it isn't mandatory.
Send your answer using a web service like https://codepen.io/
If you have any doubts, write a comment here or send a message throgh Get on Board.
*/
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment