dheeraj korangagyannbaato.hashnode.dev·Oct 18, 2024Practicing DOM ManipulationQue 1: Add the following elements to the container using only JavaScript and the DOM methods. i) a <p>with red text that says "Hey I'm red!"ii) a <h3>with blue text that says "I'm a blue h3!"iii) a <div> with a black border and pink background color ...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 17, 2024Navigation in the DOMIn JavaScript, DOM manipulation allows for dynamic changes to HTML elements, their content, and structure. Below is a detailed explanation of navigating through elements and adding/removing elements. createElement(): Creates a new element node (bu...DiscussJavascript for BegineersJavaScript
dheeraj korangagyannbaato.hashnode.dev·Oct 17, 2024Manupulating Content using DOMThe DOM (Document Object Model) allows us to interact with and manipulate the content, structure, and styles of an HTML document. Using JavaScript, we can dynamically update the page content, modify attributes, change styles, and manage classes of el...DiscussJavascript for BegineerssetAttribute
dheeraj korangagyannbaato.hashnode.dev·Oct 17, 2024Selecting Element Using JavaScript1. getElementById() The getElementById() method is used to select and return a single HTML element by its unique id attribute. Since an id should be unique within a document, this method will only return one element. If you enters a wrong id name the...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 17, 2024DOM (Document Object Model)The DOM (Document Object Model) is a programming interface provided by web browsers that represents the structure of a web page as a tree of objects. Each HTML element on the page is considered a node in the tree, allowing JavaScript to interact with...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 15, 2024Higher Order Functions In JavaScript1. forEach() Function The forEach() method is used to execute a provided function once for each element in an array. It does not return a new array; it simply iterates over the array. Syntax: array.forEach(callback(currentValue, index, array)); cal...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 14, 2024try-catch in JavaScriptThe try-catch statement in JavaScript allows you to handle errors gracefully. It consists of two main blocks: try block: Contains code that may throw an error. catch block: Executes if an error is thrown in the try block. It catches the error and h...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 14, 2024this Keyword in JavaScriptThe this keyword in JavaScript refers to the object that is currently executing the function. The value of this depends on how the function is called and can refer to different objects in different contexts. Behavior of this in Different Contexts: G...DiscussJavascript for Begineersjs
dheeraj korangagyannbaato.hashnode.dev·Oct 13, 2024Functions in JavaScriptA function in JavaScript is a block of code designed to perform a particular task. It is executed when it is called (or invoked). Functions allow code reuse and can take arguments and return values. function greet() { console.log("Hello, World!")...DiscussJavascript for BegineersJavaScript
dheeraj korangagyannbaato.hashnode.dev·Oct 13, 2024JavaScript Object LiteralIn JavaScript, an object literal is a simple way to define an object using a set of key-value pairs. You define an object literal by using curly braces {} and specifying properties inside it. const student ={ Name : "dheeraj", Uid : 9856, ...DiscussJavascript for BegineersJavaScript