1.
Document Object Model (DOM)
- DOM represents the structure of a web page as a tree of objects.
- JavaScript can access and manipulate HTML elements using the DOM.
Example:
[Link]("demo").innerHTML = "Hello DOM";
2. Form Validation
- Ensures the user provides valid input in HTML forms before submitting.
- JavaScript is commonly used for client-side validation.
Example:
function validateForm() {
let x = [Link]["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
3. Regular Expressions
- Used to match patterns in strings.
- Often used for validation (email, phone, etc).
Example:
let pattern = /^[a-z0-9]+@[a-z]+\.[a-z]{2,3}$/;
let result = [Link]("test@[Link]");
4. DHTML with JavaScript
- DHTML = HTML + CSS + JavaScript + DOM.
- Used to create dynamic and interactive web pages.
Example:
<button onclick="showMessage()">Click Me</button>
<script>
function showMessage() {
[Link]("msg").innerHTML = "Hello DHTML!";
</script>
5. Date & Object
- Date Object: Used to handle date and time.
- Object: Collection of key-value pairs.
Example:
let now = new Date();
[Link]([Link]());
let person = { name: "Alice", age: 25 };
6. Built-in Objects
- JavaScript provides many built-in objects for common tasks.
Examples:
String, Number, Boolean, Array, Math, Date, RegExp, Object, JSON, Error
Example:
let str = "Hello";
[Link]([Link]());
let nums = [1, 2, 3];
[Link]([Link]);