What is literal in javascript

literal Syntax:

{foo:'Vijay'}

JavaScript Literals are constant values that can be assigned to the variables that are called literals or constants. JavaScript Literals are syntactic representations for different types of data like numeric, string, Boolean, array, etc data. ... The literal “Vijay” represents, the value Vijay for the variable name.

Javascript Class 2 Arrow Functions

 An arrow function expression is a compact alternative to a traditional function expression, but is limited and can't be used in all situations.





Javascript Class 1 Arrays

JavaScript Arrays sing an array literal is the easiest way to create a JavaScript Array. Syntax: const array_name = [item1, item2, ...];.








What is JavaScript?

JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. (Okay, not everything, but it is amazing what you can achieve with a few lines of JavaScript code.)




Best Practices Security of codes , Breaches Attack | SSR | Angular

 Security Code

1. Preventing cross-site scripting (XSS)

The injection of scripts into DOM elements is a very common occurrence to damage or steal the website data, such as:


1.Authentication details

2.Credentials

3.Payment data

4.Social Security numbers

5.Web tokens

2. HTTP-related Vulnerabilities

Cross-site request forgery (CSRF) and cross-site script inclusion are the most common HTTP vulnerabilities that can affect any Angular application, though Angular has created in-build assistants that prevent them from the client side. 

    Angular’s cross-site scripting security model

Sanitization and security contexts

Angular defines the following security contexts:


HTML is used when interpreting a value as HTML, for example, when binding to innerHtml.

Style is used when binding CSS into the style property.

URL is used for URL properties, such as <a href>.

Resource URL is a URL that is loaded and executed as code, for example, in <script src>.

Direct use of the DOM APIs and explicit sanitization calls

    Trusting safe values

To mark a value as trusted, inject DomSanitizer and call one of the following methods:

We need to make a service for BypassUrl

bypassSecurityTrustHtml

bypassSecurityTrustScript

bypassSecurityTrustStyle

bypassSecurityTrustUrl

bypassSecurityTrustResourceUrl

Server-side XSS protection

Avoid risky Angular APIs


The “Angular way” safeguards you from XSS

1.Use innerHTML with caution

2.Never use templates generated by concatenating user input

3.Never use native DOM APIs to interact with HTML elements

4.Avoid template engines on server-side templates

5.Scan your Angular project for components which introduce security vulnerabilities


SSR

1.Facilitate web crawlers through search engine optimization (SEO)

    2.Improve performance on mobile and low-powered devices

    3.Show the first page quickly with a first-contentful paint (FCP)

Data breaches Security

1. PASSWORD ATTACK

2. PHISHING AND SPEAR PHISHING 

3. EAVESDROP ATTACK

4. CROSS-SITE SCRIPTING ATTACK

Angular Template Syntax | Demo | Example

 More on template syntax

You might also be interested in the following:

  • Interpolation—learn how to use interpolation and expressions in HTML.
  • Template statements—respond to events in your templates.
  • Binding syntax—use binding to coordinate values in your application.
  • Property binding—set properties of target elements or directive @Input() decorators.
  • Attribute, class, and style bindings—set the value of attributes, classes, and styles.
  • Event binding—listen for events and your HTML.
  • Two-way binding—share data between a class and its template.
  • Built-in directives—listen to and modify the behavior and layout of HTML.
  • Template reference variables—use special variables to reference a DOM element within a template.
  • Inputs and Outputs—share data between the parent context and child directives or components
  • Template expression operators—learn about the pipe operator, |, and protect against null or undefined values in your HTML.
  • SVG in templates—dynamically generate interactive graphics

How to use splice Method In Angular

Splice method is changes the content of an Array  Which can help the Adding new element and also can removing odd Element.

Parameters of Details

Index: Index which of changing of the Array

HomMany: In Integer How many number in odds elements of array and removed if the 0 numbers in array can removed 

Ele: The Element can add of array which can add odd element 


The Syntax  Of Splice Method 

Array.splice(index, howmany, [ele1, ele2, ....eleN ])

Demo Url



 arr = ["orange""mango""banana""sugar""tea"];

Git command with explanation

𝟭.𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged. 𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -m "commit message": Commit all tracked changes ...

Best for you