Wednesday, February 1, 2023

Angular / angular





ngAngular





 














































































































































































































































































































































this.newFramework = ""; // empty string
if (this.newFramework) 
{
                                                                console.log("This will not be logged.");
}
- **If `this.newFramework` is null, undefined, an empty string, 0, or NaN**: The condition evaluates to `false`, and the code inside the `if` block is not executed. - **If `this.newFramework` is a non-empty string, a non-zero number, an object, or any other truthy value**: The condition evaluates to `true`, and the code inside the `if` block is executed.

- **`localStorage` does not automatically clear its contents when the browser is closed.
** Data persists until explicitly removed. - If you want data to be cleared when the browser or tab is closed, use **`sessionStorage`**, which only retains data for the duration of the session

// Storing a value
localStorage.setItem('username', 'john_doe');

// Retrieving a value
const username = localStorage.getItem('username');
console.log(username); // Output: john_doe

// Removing a value
localStorage.removeItem('username');

// Trying to retrieve the value again
const removedUsername = localStorage.getItem('username');
console.log(removedUsername); // Output: null

No comments:

Post a Comment

AZ-204

 42,43,44,45,46,54,55,56,57,70, 71, 80, 98,99,100,108, 104, 105, 106, 192, 193, 194, 209, 206, 207, 210, 325,326,327,329,345,346,364,373,351...