Practical Answer
Practical Answer
Practical Answer
Practical Workbook
Prepared by
Shubham Bhargava
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JavaScript Email Validation</title>
<link rel="stylesheet" href="email.css" type="text/css" />
</head>
<body onload="document.form1.text1.focus()">
<div class="mail">
<h2>Input an Aadhar Card No.</h2>
<form name="form1" action="#">
<ul>
<li><input type="text" name="text1" /></li>
<li> </li>
<li class="validate">
<input
type="sub
mit"
name="val
idate"
value="Va
lidate"
onclick="ValidateEmail(document.form1.text1)"
/>
</li>
<li> </li>
</ul>
</form>
</div>
<script>
function ValidateEmail(input) {
var validRegex = /^[2-9]{1}[0-9]{3}\s{1}[0-9]{4}\s{1}[0-9]
{4}$/; if (input.value.match(validRegex)) {
alert("Valid Aadhar Card
No.!");
document.form1.text1.focus(
); return true;
} else {
alert("Invalid Aadhar Card
No.!");
document.form1.text1.focus(
); return false;
}
}
</script>
</body>
</html>
OUTPUT:
Q.2. Write a program that creates and run the following threads
1. To print letter ‘A’ 75 times.
2. To print letter ‘B’ 100 times.
3. To print integer 1 to 100.
INPUT:
public class Assign extends Thread
System.out.print("A ");
System.out.println();
System.out.print("B ");
System.out.println();
a1.start();
OUTPUT:
Q.3. Write a program of STACK implementation using Array with PUSH, POP operations
through JS
INPUT:
<script>
class Stack {
constructor() {
this.items = [];
push(element) {
this.items.push(element);
pop() {
return this.items.pop();
peek() {
isEmpty() {
size() {
return this.items.length;
clear() {
this.items = [];
toArray() {
return this.items;
disp(){
for(let i=this.items.length-1;i>=0;i--)
document.write(this.items[i]);
document.write("</br>");
toString() {
return this.items.toString();
document.write("<br>");
stack.push(66);
stack.push(77);
stack.push(88);
stack.disp();
document.write("<br>");
stack.push(90);
stack.disp();
document.write("<br>");
document.write("<br>");
stack.push(100);
document.write("<br>");
stack.disp();
stack.pop();
stack.pop();
stack.disp();
document.write('stack.size() after push 100 and pop twice => ', stack.size());
</script>
OUTPUT: