[go: up one dir, main page]

0% found this document useful (0 votes)
14 views2 pages

Pseudo code

pseudo

Uploaded by

khanuneza551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Pseudo code

pseudo

Uploaded by

khanuneza551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Pseudo code is a term which is often used in

programming and algorithm based fields. It is a


methodology that allows the programmer to
represent the implementation of an algorithm.
Simply, we can say that it’s the cooked up
representation of an algorithm .
Example of Pseudocode
Pseudocode is a very intuitive way to develop
software programs. To illustrate this, I am going
to refer back to a very simple program I wrote in
my:
When a user fills in a form and clicks the submit
button, execute a ValidateEmail function. What
should the function do?
1. Derive an email regular expression
(regex) to test the user's email address
against.
2. Access the user's email from the DOM
and store it in a variable. Find and use the
right DOM method for that task.

let database = ['test1@gmail.com',


'test2@gmail.com', 'test3@gmail.com'];
function validateEmail() {
let regexEmail = /^\w+([.-]?\w+)@\w+
([.-]?\w+)(.\w{2,3})+$/;
let emailAddress =
document.getElementbyID('emailFld').value;
if (!emailAddress.match(regexEmail))
{

document.getElementbyID('myAlert').innerHT
ML = "Invalid Email!";
} else if
(database.includes(emailAddress)) {

document.getElementbyID('myAlert').innerHT
ML = "Email exists!";
else {
database.push(emailAddress);

document.getElementbyID('myAlert').innerHT
ML = "Successful!";
return true;
}
}

document.getElementById("myBtn").addEvent
Listener("click", validateEmail);

You might also like