MCPcopy Create free account
hub / github.com/SuboptimalEng/coding-tutorials / getNewCodingTest

Function getNewCodingTest

react-vim-tutor/client/src/App.jsx:8–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7function 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);

Callers 1

AppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected