()
| 6 | |
| 7 | function App() { |
| 8 | const getNewCodingTest = () => { |
| 9 | const lastLine = ` `; |
| 10 | const emptyLine = ` \n`; |
| 11 | const codeToRemove = ` %\n`; |
| 12 | let testCode = ''; |
| 13 | let randomLine = Math.floor(Math.random() * 9); |
| 14 | for (let i = 0; i < 9; i++) { |
| 15 | if (randomLine === i) { |
| 16 | testCode += codeToRemove; |
| 17 | } else { |
| 18 | testCode += emptyLine; |
| 19 | } |
| 20 | } |
| 21 | testCode += lastLine; |
| 22 | return testCode; |
| 23 | }; |
| 24 | |
| 25 | const testCode = getNewCodingTest(); |
| 26 | const [code, setCode] = useState(testCode); |