rbi-learning / Today-I-Learned

1 stars 0 forks source link

Today I learned 07.31 #49

Open dnaqvi opened 4 years ago

dnaqvi commented 4 years ago

Finishing off the resume exercise

Step 1 Create an object that houses all your data keys

const data = { workExperiences: [array] educationalExperiences: [array] etc. etc Step 2 create the render function which will house your HTML

function renderWorkExperience(workExperience) { return `[INSERT HTML HERE] Step 3 Use the document query selector to select the applicable HTML id (or element)

const workExperienceContainer = document.querySelector('#work-experience');

Step 4 Transform your function using the map method:

const eachWorkExperienceHTML = data.workExperiences.map(renderWorkExperience);

Step 5 Join them all together using the join method:

const allWorkExperiencesHTML = eachWorkExperienceHTML.join('');

Step 6 Put everything into HTML using the .innerHTML method.

workExperienceContainer.innerHTML = allWorkExperiencesHTML;