Posts

Showing posts from 2022

Set up LWC Development Environment

Image
Creating LWC component in developer console is not possible. So we need to setup local development environment for it. In order to setup local development environment, we need to follow below steps: Install Salesforce CLI. Install IDE(Integrated Development Enviornment) such as VS Code. Step 1:-  Install Salesforce CLI: The Salesforce CLI is a powerful command line interface that simplifies development and build automation when working with your Salesforce org. Visit below link to download Salesforce CLI for your operating system: Link:   https://developer.salesforce.com/tools/sfdxcli If you have already Salesforce CLI installed in your system, you can update its version using below command: sfdx update To check the version of installed CLI, use below command: sfdx --version Step 2:- Install an IDE:  An integrated development environment (IDE) is software for developing applications that combine common developer tools into a single graphical user interface (GUI). An IDE ...

Difference between var, let and const keyword in JavaScript

 In JavaScript, We can declare a variable using below keywords: var let const Below are the difference between these keywords: Scope: The scope of the "var" keyword is the global scope. Means variables defined outside the function can be accessed globally. <script>     var a = 20;     function fun() {         if (true) {              var b = 30 // declared in "if" block but can be accessible outside of this "if" block.         }         console.log(b);         console.log(a);     }     fun(); </script> Output:  30 20 The scope of a "let" variable is only block scoped. It can’t be accessible outside the particular block. Have a look at below example: <script>     let a = 20;     function fun() {           if (true) {          ...

Difference between NULL and Undefined in Javascript

Null: It is the intentional absence of the value. It is one of the primitive values of JavaScript. Undefined:  When we declares a variable but doesn't assign any value to it. It means the value does not exist in the compiler. It is the global object. Below are some difference between NULL and Undefined in JavaScript: 1. NULL is assignment value. Means we can assign NULL as a value to a variable. But Undefined is not an assignment value. Example:  let firstName = NULL; // No error let firstName = undefined; // Throw error 2. Type of NULL is "Object" but type of undefined is "Undefined". Example: console.log(typeof null) // Output: object console.log(typeof undefined) // Output: undefined null == undefined // true null === undefined // false