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

Greg Schudel
Greg Schudel
4,090 Points

The links are not showing up. Check to make sure they are being appended to the DOM. (Hint: only one line of code needs

I cannot find a solution for this. What am I not understanding??

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


  // 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>

1 Answer

Steven Parker
Steven Parker
203,160 Points

You don't need to use "linkify" again. It was already called on line 17 to create "link".

At this point, you just need to append the link to div, similar to what was done with the h2 on line 23.