You can simply call redirect() at the end of function alertA(){...}

function alertA() {
    var name = prompt("What's your first name");
    if (name.length < 13) {
        alert("Hi Paul")
    } else {
        alert("Don't lie, your name is Paul");
    }
    redirect() // <<<<<<<----- calling next function
}

function redirect() {
    var r = confirm("Do you think Lee has learned JavaScript? If yes click    OK")
    if (r == true) {
        window.location = 'http://www.youtube.com';
    } else {
        window.location = 'http://www.google.com';
    }
}

You could also merge both functions into a single one:

function alertA() {
    var name = prompt("What's your first name");
    if (name.length < 13) {
        alert("Hi Paul")
    } else {
        alert("Don't lie, your name is Paul");
    }

    var r = confirm("Do you think Lee has learned JavaScript? If yes click    OK")
    if (r == true) {
        window.location = 'http://www.youtube.com';
    } else {
        window.location = 'http://www.google.com';
    }
}
Answer from franciscod on Stack Overflow
🌐
W3Schools
w3schools.com › js › js_popup.asp
JavaScript Popup Boxes
To display line breaks inside a popup box, use a back-slash followed by the character n. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript ...
Discussions

popup - Basic JavaScript pop up boxes - Stack Overflow
Can anyone see where I am doing wrong? I'd like each function to run after each other. Is this even possible the way I am doing it? Thanks Java Scr... More on stackoverflow.com
🌐 stackoverflow.com
javascript - How to create a popup box where users can copy text? - Stack Overflow
In my HTML page I generate a link, where users can grab to use for things. I need to somehow give the user the link where they can see the link and then copy the link to clip board. I don't mean ... More on stackoverflow.com
🌐 stackoverflow.com
4 Ways to Create a Modal Popup Box with Html, CSS and Vanilla JavaScript
This tutorial includes no mention of accessibility, and because it doesn't trap focus, can actually result in a bad user experience. I recommend looking over the W3 modal tutorial and incorporating some of the points about focus trapping and accessibility into this one https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/dialog.html More on reddit.com
🌐 r/learnprogramming
14
351
January 30, 2021
JavaScript Popup Dialogue Box not Opening
When I use the example ...-i-create-interactive-stamps/) that Bluebeam provides and edit it, I can no longer get the dialog box to pop up when I place the stamp on a page. All I need to do is generate a script dialog that has fillable text fields (Date Received, Date Returned, Reviewed By, etc.). But when I edit the JavaScript from the example ... More on reddit.com
🌐 r/Revu
3
2
February 26, 2019
🌐
Mobiscroll
demo.mobiscroll.com › javascript › popup
Javascript Popup Examples | Mobiscroll
3 weeks ago - Pop-over examples with customizable content, button configuration and behavior. For vanilla JS to use everywhere. Last update: Feb 24, 2026
🌐
Medium
medium.com › @ladypenguin1991 › javascript-popup-boxes-1b26d0aa89dc
Javascript Popup Boxes. I believe I can comfortably say that… | by CynthiaHarris | Medium
April 16, 2023 - When it comes to developers, however, they can be quite the useful tool. To start this article, I’m going to say one thing I like about popup boxes: They are surprisingly easy to implement in your code. With that in mind, let’s take a look at three different kinds of Javascript popup boxes: alert(), confirm(), and prompt().
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Mozilla › Add-ons › WebExtensions › user_interface › Popups
Popups - Mozilla | MDN
Unlike a normal page, though, the JavaScript can use all the WebExtension APIs that the extension has permissions for. The popup's document is loaded every time the popup is shown, and unloaded every time the popup is closed. The HTML file is included in the extension and specified as part of the browser_action or page_action key by "default_popup" in the manifest.json:
Find elsewhere
🌐
TutorialsTeacher
tutorialsteacher.com › javascript › display-popup-message-in-javascript
JavaScript Message Boxes: alert(), confirm(), prompt()
For example, you want to take the user's confirmation before saving, updating or deleting data. ... The confirm() function displays a popup message to the user with two buttons, OK and Cancel.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-build-a-javascript-alert-box-or-popup-window
How to Build a JavaScript Alert Box or Popup Window
January 25, 2020 - Popup boxes prevent the user from ... are three different kinds of popup methods used in JavaScript: window.alert(), window.confirm() and window.prompt()....
🌐
SweetAlert2
sweetalert2.github.io
SweetAlert2 - a beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes
SweetAlert2 - a beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes
🌐
Dot Net Tutorials
dotnettutorials.net › home › javascript popup boxes
JavaScript Popup Boxes with Examples - Dot Net Tutorials
June 30, 2020 - In this article, I am going to discuss JavaScript Popup Boxes with Examples. JavaScript has 3 types of popup boxes.Alert box, Confirmation box, & Prompt box
🌐
Use My Notes
usemynotes.com › home › javascript crash course for free › javascript popup boxes
JavaScript Popup Boxes - UseMyNotes
January 16, 2023 - An alert box is the first type of JavaScript Popup Boxes. This popup or dialog box is used to display an alert or warning message to the user. To proceed, the user must click “OK.” We use the alert() method of the window object to show an ...
🌐
Codingem
codingem.com › home › javascript popup boxes
JavaScript Popup Boxes - codingem.com
July 10, 2025 - Prompt Box. ... // Alert window.alert("something"); // Confirm window.confirm("something"); // Prompt window.prompt("something", "default text"); This is a complete guide to popups in JavaScript.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-create-popup-box-using-html-css-and-javascript
How to create Popup Box using HTML CSS and JavaScript? - GeeksforGeeks
In JavaScript, first, get button elements through their id or class and then apply addEventListener on the Popup button as well as the Close button. "Click" event is used, popup box appears while clicking on the popup button.
Published   August 5, 2025
🌐
W3Schools
w3schools.com › howto › howto_js_popup.asp
How To Create Popups
Fullscreen Video Modal Boxes Delete Modal Timeline Scroll Indicator Progress Bars Skill Bar Range Sliders Color Picker Email Field Tooltips Display Element Hover Popups Collapsible Calendar HTML Includes To Do List Loaders Badges Star Rating User Rating Overlay Effect Contact Chips Cards Flip Card Profile Card Product Card Alerts Callout Notes Labels Ribbon Tag Cloud Circles Style HR Coupon List Group List Group with Badges List Without Bullets Responsive Text Cutout Text Glowing Text Fixed Footer Sticky Element Equal Height Clearfix Responsive Floats Snackbar Fullscreen Window Scroll Drawing
🌐
NIELIT
nielit.gov.in › gorakhpur › sites › default › files › Gorakhpur › OLEVEL_1_WPD_26_May_2020_IL.pdf pdf
Pop up boxes in JavaScript - Gorakhpur
To do such things on webpages, JavaScript provides mainly three types of pop-up or · dialog boxes. These are · 1. Alert Dialog Box · 2. Confirmation Dialog Box · 3. Prompt Dialog Box · 1. Alert Dialog Box · Alert box gives only one button "OK” and it is mandatorily be clicked to close ...
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › javascript popup box
JavaScript Popup Box | Learn 3 Types of Popup Box in JavaScript
June 13, 2023 - Popup boxes like alert, prompt, and confirm boxes give the user further step information. Alert Box for the warning, prompt box input values, and confirm Box for the user’s decision. This is a guide to JavaScript Popup Box. Here we discuss the three alert boxes, confirm and prompt Box, with syntax and examples to implement.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Way2tutorial
way2tutorial.com › javascript › javascript-popup-boxes.php
JavaScript Popup Boxes
JavaScript Popup boxes are three types alert box, confirm box, prompt box. JavaScript Alert Box (alert message display to a browser), JavaScript Confirm Box (verify or accept some confirm message from user and display on bowser), JavaScript Prompt Box (fetch value from user and display on browser).
🌐
Studytonight
studytonight.com › javascript › javascript-popup-boxes
JavaScript Popup Boxes - Studytonight
May 9, 2020 - Following is the syntax for the JavaScript Prompt box: let result = prompt("SOME MESSAGE", "DEFAULT_VALUE"); Here, SOME MESSAGE is the message which is displayed in the popup box, and DEFAULT_VALUE is the default value in the input field.