# Web Hacking: JavaScript Essentials (TryHackMe)

In this article, I will write a write-up for Web Hacking: Javascript Essentials that covers the Essentials Concepts, Javascript Overview, Integrating Javascript in HTML, Abusing Dialogue Functions, Bypassing Control Flow Statements, Exploring Minified Files, and Best Practices.

1. What term allows you to run a code block multiple times as long as it is a condition? `loop`
    
2. What is the code output if the value of x is changed to 10? `The result is: 20`
    
3. Is JavaScript a compiled or interpreted language? `Interpreted`
    
4. Which type of JavaScript integration places the code directly within the HTML document? `Internal`
    
5. Which method is better for reusing JS across multiple web pages? `External`
    
6. What is the name of the external JS file that is being called by **external\_test.html**? `thm_external.js`
    
7. What attribute links an external JS file in the &lt;script&gt; tag? `src`
    
8. In the file **invoice.html**, how many times does the code show the alert Hacked? `3`
    
9. Which of the JS interactive elements should be used to display a dialogue box that asks the user for input? `prompt`
    
10. If the user enters Tesla, what value is stored in the carName= prompt("What is your car name?")? in the carName variable? `Tesla`
    
11. What is the message displayed if you enter the age less than 18? `You are a minor.`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730386888893/60536eed-9e04-4ed0-ac74-1b90441d3469.png align="center")
    
12. What is the password for the user admin? `ComplexPassword`
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730386872922/05526adb-32f8-42b8-a7ab-11f2e8454017.png align="center")
    
13. What is the alert message shown after running the file **hello.html**? `Welcome to THM`
    
14. What is the value of the **age** variable in the following obfuscated code snippet?age=0x1*0x247e+0x35*\-0x2e+-0x1ae3; `21`
    

Obfuscation is still unclear to me but there’s this [YouTube Video](https://youtu.be/8SmJNWiMouo?si=WQyz1dQCNNU1gk2E) that has a walkthrough from around minute 26 and also use this [Javascript Obfuscator Tool](https://obfuscator.io/) as well as tools like ChatGPT for more deep dive into the topic 15. Is it a good practice to blindly include JS in your code from any source (yea/nay)? `nay`

Thank you for reading my article. Please leave any questions or comments on improving my learning journey and the THM challenges.
