Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function format(input) {
- let str = '<?xml version="1.0" encoding="UTF-8"?>\n<quiz>\n';
- let questions = '';
- let answers='';
- for(let i = 0; i <= input.length - 1; i+=2) {
- let question = input[i];
- let answer = input[i+1];
- str += ` <question>\n${question}\n</question>\n`;
- str += ` <answer>\n${answer}\n</answer>\n`;
- }
- str += '</quiz>';
- console.log(str);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement