RedditPosts.js

let getTopTenSubRedditPosts = (type) => { let response try{ response = JSON.parse(request('GET',"https://www. reddit.com/r/subreddits/" + type + ".json?limit=10"). getBody('utf8')) }catch(err) { response = { message: "Something went wrong" , errorCode: err['statusCode'] } } return response }
Because MayBe is a type of container that can hold any values, it can also hold values of type Array. Imagine you have written an API to get the top 10 SubReddit data based on types like top, new, and hot.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.