There is an open ticket here: https://phabricator.wikimedia.org/T62835
If you wish to use the Media Wiki API, you have to use JSONP format.
I understand many people are confused about this, I was as well. How can I suggest to freeCodeCamp they do something about this? They should really include this information on their Wikipedia Viewer challenge, as this information runs contrary to this link: https://www.mediawiki.org/wiki/API:Cross-site_requests that freeCodeCamp puts up on the challenge page.
Media Wiki claims that CORS has been working since 2012, but clearly this is not true for external sites such as Codepen.