Question

Javascript each item must have at least three categorical attributes and at least one numeric attribute....

Javascript

each item must have at least three categorical attributes and at least one numeric attribute. Attributes such as ID, name etc do not count as categorical or numeric attributes.

Exercise 1

(a) Define a class for your item that meets the above three categorical and one numeric attribute requirements.

(b) Create a text file that contains at least 5 such records in CSV format.

(c) Create a HTML page that contains a table element the shows one item record (hardcoded in the HTML).

(d) Add a script element into your HTML page that prints ‘hello’ to the browser’s JavaScript developer console.

(e) Add JavaScript code that uses ‘fetch’ into your HTML page that loads your item text file. Use a python initiated local server to serve that text file.

Exercise 2

Write a function that counts the number of values each item attribute has. This is effectively a group-by on the item table for each column.

For example: if the first attribute is colour, and its values are [ ‘red’, ‘black’, ‘white’, ‘black’, ‘red’ ], the counts for colour would be:

red 2 black 2 white 1

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Author: Rishabh Jain

Date:08/09/2019

<html>

<head></head>

<body>

<table>

<tr>

<th>Industry Type</th>

<th>Occupational Safety and Health</th>

<th>Sources of Hazards</th>

<th>Scale of Workers</th>

</tr>

<tr>

<td>Chemical</td>

<td>General</td>

<td>Acid</td>

<td>200</td>

</tr>

</table>

<script>

console.log("Hello");

url='' //enter your url

let response = fetch(url);

if (response.ok) { // if HTTP-status is 200-299
// get the response body (the method explained below)
let json = response.json();
} else {
alert("HTTP-Error: " + response.status);
}
console.log(response)

</script>

</body>

</html>

//-------------------------------------------------------------------------------------------------------------------------------

Exercise 2:

<html>

<head>

</head>

<body>

<script>

function count_value( arr ){

const map = arr.reduce((acc, e) => acc.set(e, acc.get(e) + 1 || 1), new Map());
//console.info(...map.values())
console.info(...map.entries())

}

var array=[ "red", "black", "white","black", "red" ];

count_value(array);

//output is ["red", 2] ["black", 2] ["white", 1]

</script>

</body>

</html>

Add a comment
Know the answer?
Add Answer to:
Javascript each item must have at least three categorical attributes and at least one numeric attribute....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • javascript

    In this project you will write the JavaScript code to create a calculator. Good thing is that everyone knows how the calculator works. It is a challenging project, give yourself lots of time to complete it.1. You are provided with an HTML, and CSS files.. Look at these files to understandhow to use them and modify them if needed based on your code. (Note: You can adddifferent selector (id, class) in HTML ONLY and cannot make any changes to CSS.)Create...

  • Must be car Themed My first JS-DOM color:red; text node!'); //creates 'This is a text node!'...

    Must be car Themed My first JS-DOM color:red; text node!'); //creates 'This is a text node!' color:blue; font-family: arial; Clicker Counter: 0 Interface should look something like this, but does not have to be one for one like this picture One of JavaScript's powers is to be able to interact with the DOM directly. You've seen this when using commands such as document.getElementById("idName'). This document allows you to search HTML for certain elements. It turns out that you can also...

  • (Below I have posted my full assignment so my question makes sense with context. The part...

    (Below I have posted my full assignment so my question makes sense with context. The part I am struggling with is section e. I am not sure how to create the said class. If you could help it would be appreciated. Also, this is all HTML code.) In this assignment you will create a web page about your favorite TV show of all-time and link it to an external style sheet to apply a few CSS rules to it. Follow...

  • given below are the project description and their Html and css files i need javascript according...

    given below are the project description and their Html and css files i need javascript according to the project and other files! WEB230 - JavaScript 1 Assignment 6b - Event Delegation Before starting, study the HTML and open it in a browser so that you understand the structure of the document. You will add functionality to perform several tasks in our shopping list app. Clicking the red "X" at the right of an item will delete that item. Clicking on...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • Can someone please help me with this javascript - Javascript - do at least 10 of...

    Can someone please help me with this javascript - Javascript - do at least 10 of the following questions below ----------------------------------------------------------------------------------- Create an HTML file that takes in input and carries out of the following functions and manipulates the DOM to show the outcome. Please put the question itself as a comment above each answer. Use either JavaScript, jQuery, or both (but know the difference!). ----------------------------------------------------------------------------------- 1. Fibonacci Define function: fib(n) Return the nth number in the fibonacci sequence. 2....

  • Website Case Study 59 JavaJam Coffee Hous Home Dobs Gear avaJam Gear Jnva)am Shirt Figure 12.6 Ne...

    JavaJam Gear Page We were unable to transcribe this imageWebsite Case Study 59 JavaJam Coffee Hous Home Dobs Gear avaJam Gear Jnva)am Shirt Figure 12.6 New JavaJam Gear page Task 4: Create the New Gear Page. One way to be productive is to create pages based on earlier work. Launch a text editor and cpen the Music page (music.html). Save the file your as gearhtml. This will give you a head start and ensure that the pages on the website...

  • Unit 1 Programming Assignment Follow the directions for each of the following questions. Answer the question...

    Unit 1 Programming Assignment Follow the directions for each of the following questions. Answer the question or provide the code in a space below the question. 1. Write the complete script tag set for a script whose line statement is document.write(“Hello, world.”); 2. Build a complete HTML document and include the answer to the previous question such that the page executes the script as the page loads. Open the document in your browser to test the results. 3. Add a...

  • 2 Apply Your Knowledge Reinforce the skills and apply the concepts you learned in this chapter Styling a Webpage Instru...

    2 Apply Your Knowledge Reinforce the skills and apply the concepts you learned in this chapter Styling a Webpage Instructions: In this exercise, you will use your text editor to create external, embedded, and inline styles for the Durango Jewelry and Gem Shop home page. You will style the sections of the semantic wireframe header, nav, main, and tooter and a div element that surrounds all of the content to center the content on the page. You will also float...

  • n the Labs Labs 1 and 2, which increase in difficulty, require you to create webpages based on what you learned in the...

    n the Labs Labs 1 and 2, which increase in difficulty, require you to create webpages based on what you learned in the chapter; Lab 3 requires you to dive deeper into a topic covered in the chapter. Lab 1: Creating an External Style Sheet for City Farmer Problem: You work for a local but rapidly growing gardening supply company called City Farmer that specializes in products that support food self-sufficiency. The company has hired you to help create the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT