Function to check if a string is valid email address
function isValidEmail(email) {
if (!email) {
return false;
}
const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailPattern.test(email);
}| let fetchData = async () => { | |
| const res = await fetch('https://bookshelf.gq/api/books'); | |
| const data = await res.json(); | |
| console.log('data is ready', data); | |
| const res2 = await fetch('https://dikz.herokuapp.com/api/latest'); | |
| const data2 = await res2.json(); | |
| console.log('data2 is ready!', data2); |
| .spinner { | |
| display: inline-block; | |
| width: 80px; | |
| height: 80px; | |
| } | |
| .spinner:after { | |
| content: ' '; | |
| display: block; | |
| width: 64px; | |
| height: 64px; |
Function to check if a string is valid email address
function isValidEmail(email) {
if (!email) {
return false;
}
const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailPattern.test(email);
}Import the package and set up transporter.
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.MAILUSER,
pass: process.env.MAILPASS
}rm -rf node_modules
npm cache verify
npm cache clean --force
npx npm-check-updates -u
npm installor even better
npm update| { | |
| "explorer.confirmDelete": false, | |
| "editor.fontFamily": "Operator Mono,Cascadia Code,'Fira Code', Menlo, monospace, consolas", | |
| "editor.fontSize": 15, | |
| "terminal.integrated.fontFamily": "Cascadia Code", | |
| "editor.fontLigatures": true, | |
| "prettier.trailingComma": "none", | |
| "prettier.singleQuote": true, | |
| "prettier.semi": true, | |
| "javascript.updateImportsOnFileMove.enabled": "always", |
| const states = [ | |
| { | |
| from: 1, | |
| to: 20, | |
| stateName: 'Andhra Pradesh' | |
| }, | |
| { | |
| from: 21, | |
| to: 40, | |
| stateName: 'Arunachal Pradesh' |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Form Validation</title> | |
| </head> | |
| <body> | |
| <input id="fullName" type="text" minlength="4"><button id="btn">Submit</button> |