Commit eaf68cfe authored by Sander Kvenild's avatar Sander Kvenild
Browse files

Created a table that shows JSON values

parent a2d618b7
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Oblig 5</title>
table, th, td{
border: 1px solid black;
<h1>Oblig 5</h1>
<tbody id="peaks">
<script src="index.js"></script>
\ No newline at end of file
let peaks = document.getElementById("peaks");
.then(response => response.json())
.then(json => {
for (const peak of json) {
let fylke = document.createElement('td');
fylke.innerText = peak.fylke;
let navn = document.createElement('td');
navn.innerText = peak.navn;
let height = document.createElement('td');
height.innerText = `${peak.høyde} m`;
let row = document.createElement('tr');
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment