JavaScript DOM Scripting By Example Improving the Application Code Fix Function that Should be Creating Links

Julien Arseneau
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 Points

I really don't understand the challenge.

I can't figure it out!

const languages = ['Python', 'JavaScript', 'PHP', 'Ruby', 'Java', 'C'];
const section = document.getElementsByTagName('section')[0];

// Accepts a language name and returns a wikipedia link
function linkify(language) {
  const a = document.createElement('a');
  const url = '' + language + '_(programming_language)';
  a.href = url;
  return a;

// Creates and returns a div
function createDiv(language) {
  const div = document.createElement('div');
  const h2 = document.createElement('h2');
  const p = document.createElement('p');
  const link = linkify(language);

  h2.textContent = language;
  p.textContent = 'Information about ' + language;


  // Your code below
for (let i = 0; i < linkify.length; i += 1) {
  let div = createDiv(languages[linkify]);

  // end

  return div;

for (let i = 0; i < languages.length; i += 1) {
  let div = createDiv(languages[i]);

<!DOCTYPE html>
  <title>Programming Languages</title>
    body {
      font-family: sans-serif;
  <h1>Programming Languages</h1>
  <script src="app.js"></script>

2 Answers

Steven Parker
Steven Parker
152,680 Points

Here's a few hints:

  • you won't need a loop
  • you'll only need one line of code
  • you only need to add the link, similarly to how the heading is added
  • the code that adds the heading is just above where your code will go and makes a good example