DOM
-> Document Object Model is a programming interface that represents an HTML document as a tree of objects.
events:
onClick()
dblclick()
function changeTxt(){
const ele = document.getElementById("title").innerText="hello"
the innerText helps to changes your text.
document.createElement -> here you can create an element like document.createElement(div) , document.createElement(h1)
localStorage
localStorage -> built in web storage object in js that allows you to save key-value pairs
eg: localStorage.setItem('theme', 'dark');
localStorage.getItem('theme');
JSON.stringify() -> converts a JavaScript object, array, or primitive value into a JSON string.
eg: const user = {
"name": "Alex",
"age": "28"
JSON.parse() ->JSON string and converts it into a JavaScript object or array.
// A text string formatted as JSON
const jsonString = '{"name":"Alex","age":28}';
// Convert the string into a live JavaScript object
const userObj = JSON.parse(jsonString);
console.log(userObj.name); // Output: "Alex"
console.log(userObj.age); // Output: 28
console.log(typeof userObj); // Output: "object"
Synchronous -> One by one execution
Asynchronous -> Simultaneously execution
Top comments (0)