Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let tables = `<table border="1">
- <thead>
- <tr><th colspan="3">Blades</th></tr>
- <tr><th>Length [cm]</th><th>Type</th><th>Application</th></tr>
- </thead>
- <tbody>\n`;
- for (let line of input) {
- let width = Number(Math.floor(line));
- if (width <= 10) {
- continue;
- }
- let type = "dagger";
- let application = "blade";
- if (width > 40) {
- type = "sword";
- }
- switch (width % 5) {
- case 0:
- application = "*rap-poker";
- break;
- case 1:
- application = "blade";
- break;
- case 2:
- application = "quite a blade";
- break;
- case 3:
- application = "pants-scraper";
- break;
- case 4:
- application = "frog-butcher";
- break;
- }
- tables+=`<tr><td>${width}</td><td>${type}</td><td>${application}</td></tr>
- `
- }
- tables+=`</tbody>
- </table>`;
- console.log(tables);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement