DevTools vs JSON Stringify: Task Chain & Login Flow in Sololearn Playground Environment V.3.1.65
+5

html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="author" content="Konan" />
<title>DevTools vs JSON Stringify: Task Chain & Login Flow in Sololearn Playground Environment</title>
<!-- Google Fonts & Font Awesome -->
<link href="https://fonts.googleapis.com/css2?family=Fira+Code&family=JetBrains+Mono&display=swap" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
<h1><i class="fas fa-code-branch"></i> DevTools vs JSON Stringify: Task Chain & Login Flow in Sololearn Playground Environment</h1>
</header>
<div class="container">
<section class="output-panel" id="devtools-panel-2">
<h2><i class="fas fa-bug"></i> DevTools Output (Incorrect (in this environment))</h2>
<ul id="task-log-devtools-2"></ul>
</section>
<section class="output-panel" id="json-panel-2">
<h2><i class="fas fa-check-circle"></i> JSON Stringify Output (Correct (in this environment))</h2>
<ul id="task-log-json-2"></ul>
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'JetBrains Mono', monospace;
background: linear-gradient(to right, #ece9e6, #ffffff);
color: #1a1a1a;
height: 100vh;
display: flex;
flex-direction: column;
}
header {
text-align: center;
padding: 2rem 1rem;
background-color: #111;
color: #fff;
}
header h1 {
font-size: 1.45rem;
}
.container {
display: flex;
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
document.addEventListener('DOMContentLoaded', () => {
// ----- CORE UTILITIES ------
function asyncTask(message, delay) {
return new Promise(resolve => {
setTimeout(() => {
logTask(message);
resolve();
}, delay);
});
}
function loginUser(username, password) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (password === 'etc.1') resolve({ id: 42, username });
else reject(new Error('Invalid credentials'));
}, 1500);
});
}
function fetchProfile(userId) {
return new Promise(resolve => {
setTimeout(() => {
resolve({ userId, displayName: 'Konan One', roles: ['admin', 'user'] });
}, 1000);
});
}
BROWSER
Console
Run