Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- String.prototype.htmlEscape = function(){
- return this.replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
- };
- let result = "<table>\n <tr><th>name</th><th>score</th></tr>\n";
- let table = JSON.parse(input);
- for (let record of table) {
- result += ` <tr><td>${record.name.htmlEscape()}</td><td>${record.score}</td></tr>\n`;
- }
- result += "</table>";
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement