This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<xs:element name="library" type="libraryType"/> | |
<xs:complexType name="libraryType"> | |
<xs:sequence> | |
<xs:element name="name" type="xs:string"/> | |
<xs:element name="location" type="xs:string"/> | |
<xs:element name="books" type="bookType" minOccurs="0" maxOccurs="unbounded"/> | |
<xs:element name="members" type="memberType" minOccurs="0" maxOccurs="unbounded"/> | |
</xs:sequence> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<student> | |
<firstName>Jane</firstName> | |
<lastName>Doe</lastName> | |
<age>22</age> | |
<gender>Female</gender> | |
<address> | |
<street>123 Main St</street> | |
<city>Anytown</city> | |
<state>NY</state> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibonacci(n) { | |
let a = 0, b = 1, c; | |
for (let i = 0; i < n; i++) { | |
console.log(a); | |
c = a + b; | |
a = b; | |
b = c; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sumFirstTen() { | |
let sum = 0; | |
for(let i = 1; i <= 10; i++) { | |
sum += i; | |
} | |
return sum; | |
} | |
console.log(sumFirstTen()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateForm() { | |
var zipcode = document.forms["formName"]["zipcode"].value; | |
var state = document.forms["formName"]["state"].value; | |
var zipcodeRegExp = /^\d{5}(?:[-\s]\d{4})?$/; | |
var stateRegExp = /^[A-Za-z]{2}$/; | |
if(!zipcodeRegExp.test(zipcode)) { | |
alert("Invalid zip code format, Please enter valid zip code."); | |
return false; | |
} | |
if(!stateRegExp.test(state)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorial(n) { | |
let result = 1; | |
for (let i = 1; i <= n; i++) { | |
result *= i; | |
} | |
return result; | |
} | |
console.log(factorial(5)); // 120 | |
console.log(factorial(7)); // 5040 | |
console.log(factorial(10)); // 3628800 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function average() { | |
let sum = 0; | |
for(let i = 1; i <= 10; i++) { | |
sum += i; | |
} | |
return sum/10; | |
} | |
console.log(average()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addNumbers(...nums) { | |
let sum = 0; | |
for (let num of nums) { | |
sum += num; | |
} | |
return sum; | |
} | |
console.log(addNumbers(1, 2, 3, 4, 5)); // 15 | |
console.log(addNumbers(5, 10, 15)); // 30 | |
console.log(addNumbers(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); // 55 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPrime(n) { | |
if (n < 2) { | |
return false; | |
} | |
for (let i = 2; i <= Math.sqrt(n); i++) { | |
if (n % i == 0) { | |
return false; | |
} | |
} | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Student Registration Form</title> | |
</head> | |
<body> | |
<form action="submit.php" method="post"> | |
<label for="name">Name:</label> | |
<input type="text" id="name" name="name"><br> | |
NewerOlder