Font Size
15px

Jeff downloaded the Zip file, extracting its contents, and then opened the project folder. Inside were typical web developnt files.

Like index.html, style.css, script.js, and a READ.txt, along with a screenshot showing a browser console error.

He then opened Visual Studio Code, navigated to the project directory, and began the setup.

...

Bash

npm install

npm start

...

The app loaded in the browser. It was a simple contact form with fields for Na, Email, and ssage. The design was clean, but there were a few noticeable bugs.

Jeff filled in a test ssage and clicked Submit.

Click!

The page refreshed after waiting for a while for the confirmation. No ssage was sent to the server.

He opened the browser's DevTools console, and sure enough, an error glared back. Making him glare as well.

[Uncaught TypeError: Cannot read properties of undefined (reading 'value')]

Jeff squinted at the screen, his eyes narrowing on line 27 of script.js. The code was trying to access form elents before the DOM had fully loaded.

He clicked over to the JavaScript file to confirm. Sure enough, the event listener had been declared outside the DOMContentLoaded block, which ant the script was trying to interact with elents that weren't available yet.

"Beginner's trap," he muttered to himself.

With his god-tier programming skill, he was literally not a beginner at this mont.

This was an easy fix for soone like him, a god of programming. Without wasting ti, he got to work.

He wrapped the existing code inside a docunt.addEventListener('DOMContentLoaded', ...) block to ensure the script only ran after the entire page had finished loading.

Next, he noticed another common mistake. The form was missing event.preventDefault(), which ant the browser was refreshing the page before any JavaScript could execute properly.

"This is why your ssage isn't submitting, my guy," he mused inwardly, already rewriting the function with calm look.

He then added the following line.

...

JavaScript

form.addEventListener('submit', function(e) {

e.preventDefault();

// ...rest of code

});

...

(Authors Note: JavaScript is a scripting or programming language that enables you to create dynamically updating content, control multidia, animate images, and much more on web pages. It is one of the core technologies of the web, alongside HTML and CSS)

Lastly, the fetch() function was present, but it lacked proper headers and didn't include JSON.stringify().

This ant that even if the request reached the server, it would likely cause an error or be rejected entirely.

So, he rewrote the submission logic properly. He added the necessary headers to specify the content type as JSON and wrapped the form data in JSON.stringify() to ensure it was correctly formatted before being sent to the server.

With a few precise keystrokes, the broken logic was replaced with clean, functional code.

...

JavaScript

fetch('/contact', {

thod: 'POST',

headers: {...rest of code

...

"There was no validation, no error handling. this guy must be new in programming," Jeff thought as he saved the file.

He tested the form again filled it out, clicked submit. This ti, no page reload. The alert popped up.

"ssage sent!"

He checked the terminal log and saw the data appeared perfectly formatted, just as expected.

Since he had so ti to spare, he decided to go the extra mile. He refactored the code, fixed the inconsistencies, and made sure every line was clean, readable, and precise.

By the ti he was done, the code looked so polished that even senior developers would be shocked by its clarity and structure.

After all, readability is king.

Code isn't written just for machines, it's written for other humans too.

If a senior developer opens your file and can instantly understand the flow, logic, and purpose, it leaves a lasting impression.

In the developer world, writing clean, readable, and well-structured code is a huge deal. In fact, it's often more impressive than writing overly complicated, clever code that no one else can understand.

But Jeff does not know this, the reason why he does this is because he felt itchy if he does not fix it.

Razon: Hey, I fixed all the issues. I wrapped your script in a DOMContentLoaded event, added preventDefault(), and rewrote your fetch call with proper headers and JSON formatting. I also added comnts to explain the changes so you can learn from them.

Let know if you want help upgrading the design or adding form validation!

Jeff then leaned back as he lie down on the bed, it only took him like 5 minutes. The lines of codes are more than a hundred but he did it in a minute.

He had already exceeded the ability of artificial intelligence back in his own world.

The client, after finishing boiling so water and making a cup of coffee, returned to his desk.

When he sat down, he noticed an unread ssage that had arrived about five minutes earlier. Placing the cup on the table, he opened it.

What he saw left him stunned.

As he scrolled up and reread the conversation, he realized that only five minutes had passed since he assigned the task, and it was already complete.

"Is this guy ntraly retarded! if you are trying to scam , then you failed. He should at least make it more believable," he muttered wondering if this guy had so loose screws..

But still to check it since their was already a zip file attached in their. He downloaded it and run it on his own pc.

Seeing the program made him froze and stunned, it looks so different from his. Like everything was not the sa anymore.

Feeling doubtful, he ran the code to check it himself. At first glance, the appearance of the form was still the sa, but when he typed a ssage and clicked send, it worked perfectly.

"Ey, it actually works. He even added comnts to help understand," he said in surprise.

As he continued to read the codes, he was even more surprised why everything is so arranged.

"Damn, is this guy a master? Then I'm in luck. Failing the first sester is not going to happen after all," he added, feeling ecstatic.

Client: Thanks I just checked it and its really good, where should I send the paynt?

Seeing everything worked perfectly, Jeff quickly sent over his PayPal account. The client who was now convinced, responded by sending the paynt.

Monts later, a notification popped up on Jeff's screen. He then checked it imdiately.

[You've received $15.00 USD from .]

After that, Jeff continued his hunt for new tasks, scrolling through listings and coding non-stop.

Each ti he finished a project, he repeated the sa process, completing jobs quickly and efficiently.

His profile soon displayed a perfect five-star rating from multiple clients. With each completed task, he earned more, and in just a short ti, his earnings had reached hundreds of dollars.

Finally, after three straight hours, he stopped. His hands were numb, and his fingers trembled from constant typing.

He picked up his phone to check his balance. What he saw made his eyes widen in shock.

You are reading Lucky Spin: Godly Programming Chapter 7: Earning lots of Money on novel69. Use the chapter navigation above or below to continue reading the latest translated chapters.
Share with your friends
Library saves books to your account. Reading History saves recent chapters in this browser.
Continuous reading

You may also like

Slime True Immortal cover
Similar genre

Slime True Immortal

肚子有点胀 ·Fantasy

Spring—aseasonofrenewalandrebirth.Intheswampforest,magicalbeastswerebeginningtostir.Onthereed-linedriverbanks,beastkinsharpenedsticksandsettraps,ly...

No reviews yet. Be the first reader to leave one.
Please create an account or sign in to post a comment.