Skip to main content

Javascript: Methods

Intro

This post will cover some of the basic uses methods of Javascript. Methods are useful pieces of code that are baked right into Javascript that you can recall.

alert

The alert method is the single worst thing that has ever happened in the history of the internet. It creates annoying pop-up windows that have been used by scammers and advertisers forever. And yet, they still exist…

alert("Whoever created this method is going to rot in hell.")

an alert box appears

They really are…

prompt

Similar to alert, this opens a pop-up window, but it includes an input field and asks the user for a specific piece of information. For example:

prompt("What is your Social Security #")

social security prompt

and the input will be added to the console

social security returned to console

This would actually get useful when you can assign variables to the user prompt such as:

assigning variable to prompt

console.log

The ethical younger brother of alert(). This logs something in the console.

a console log

The most used method of them all.

clear ()

this will simply clear the console to give you clean working space. There is no useful way to screenshot this because I will just be showing a clear console…

Comments

Recent Work

Free desktop AI Chat client, designed for developers and businesses. Unlocks advanced model settings only available in the API. Includes quality of life features like custom syntax highlighting.

Learn More

BidBear

bidbear.io

Bidbear is a report automation tool. It downloads Amazon Seller and Advertising reports, daily, to a private database. It then merges and formats the data into beautiful, on demand, exportable performance reports.

Learn More