Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Big Idea Working with your partner, create a function that depends on conditionals. Task 1 : Create an index.html for your lab As always, create

Big Idea
Working with your partner, create a function that depends on conditionals.
Task 1: Create an index.html for your lab
As always, create the proper folders and an index, css, and JavaScript files for this lab. And make sure you also put a link from your art 101 homepage to this lab
Create an index.html with three organized sections: Challenge, Problems, and Results
Use heading, div, and paragraph tags to organize your page
As usual, link a JavaScript file from the section of your HTML like this:
Task 2: Create a JavaScript file
Create a new javascript file in your code editor in your lab's js folder
Put a comment block at the top of your program
Create a function sortingHat()
that takes a string as an argument: function sortingHat(str)
counts the letters in str and assigns it to a variable length
uses modulus (% operator) to get the remainder with 4: mod = length %4;
mod will now be a value between 0 and 3
create a conditional that will return Gryffindor, Ravenclaw, Slytherin, and Hufflepuff depending on whether the value of mod is 0,1,2, or 3
Create an click listener attached to #button
that gets the value of #input and assigns it to a variable name
runs sortingHat(name) and stores the result in a variable house
appends a new styled paragraph to #output that says "The Sorting
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions