ga-wdi-exercises / fellowship Goto Github PK
View Code? Open in Web Editor NEW[javascript, dom, objects]
[javascript, dom, objects]
The starter and solution JavaScript code is structured in a confusing way. Recommend to have a single interface method in the "fellowship" object and remove the parameters from the other methods:
var fellowship = {
โฆ,
makeEverything: function() {
this.makeMiddleEarth();
this.makeHobbits();
this.keepItSecretKeepItSafe();
this.makeBuddies();
this.beautifulStranger();
this.forgeTheFellowShip();
}
}
// call a single method that does everything:
fellowship.makeEverything();
var fellowship = {
hobbits: [
"Frodo Baggins",
"Samwise 'Sam' Gamgee",
"Meriadoc \"Merry\" Brandybuck",
"Peregrin 'Pippin' Took"
],
buddies: [
"Gandalf the Grey",
"Legolas",
"Gimli",
"Strider",
"Boromir"
],
lands: [
"The Shire", "Rivendell", "Mordor"
],
makeMiddleEarth: function(lands) {
for(var i = 0; i < fellowship.lands.length; i++) {
console.log(fellowship.lands[i]);
var land = document.createElement("article")
var middleearth = document.getElementById("middle-earth").
appendChild(land)
var h1 = document.createElement('h1')
land.appendChild(h1)
}
// create a section tag with an id of middle-earth
for(var i =0; i < fellowship.length; i ++);
var middleearth = document.createElement('section')
var land = document.createElement('article')
var middleearth = document.getElementById('middle-earth').appendChild(land)
var h1 = document.createElement('h1')land.appendChild(h1)
// add each land as an article tag
// inside each article tag include an h1 with the name of the land
// append middle-earth to your document body
makeHobbits: function(hobbits) {
var hobbitslist = document.createElement('ul')
// display an unordered list of hobbits in the shire
// give each hobbit a class of hobbit
for( i = 0; i > hobbits.length; i++);
hobbit.textContent = hobbits[i];
hobbit.className = 'hobbit';
},
keepItSecretKeepItSafe: function() {
var ring = document.createElement('div').appendChild('ring');
ring.id = 'the-ring'
// add the ring as a child of Frodo
},
makeBuddies: function(buddies) {
var asidetag = document.createElement('asidetag');
// create an aside tag
var buddies = document.createElement('ul');
// display an unordered list of buddies in the aside
// insert your aside before rivendell
},
beautifulStranger: function() {
// change the buddy 'Strider' textnode to "Aragorn"
var buddy = document.getElementsByTagName('aside')[0].getElementsByTagName('li');
var striders = buddy[3];
Strider.textContent = 'Aragorn'
},
forgeTheFellowShip: function() {
var the-fellowship = document.createElement('div');
the-fellowship.id = ('hobbits');
// move the hobbits and the buddies to Rivendell
// create a new div called 'the-fellowship'
// add each hobbit and buddy one at a time to 'the-fellowship'
// after each character is added make an alert that they have joined your party
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.