Apex:
- Home
- Archives forMarch 2026
Nullish coalescing operator
-> The nullish coalescing (??) operator is a logical operator that returns its right-hand side operand when its left-hand side
operand is null or undefined, and otherwise returns its left-hand side operand.
## Syntaxt: leftExpr ?? rightExpr
Documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing#assigning_a_default_value_to_a_variable
###Nullish coalescing assignment (??=)
-> The nullish coalescing assignment (??=) operator, also known as the logical nullish assignment operator,
only evaluates the right operand and assigns to the left if the left operand is nullish (null or undefined).
## Syntaxt: x ??= y
-> Exmaple:
const a = { duration: 50 };
a.duration ??= 10;
console.log(a.duration);
// Expected output: 50
a.speed ??= 25;
console.log(a.speed);
// Expected output: 25
Documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment
Optional chaining (.)
-> The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator
is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error.
### Syntax:
obj.val?.prop
obj.val?.[expr]
obj.func?.(args)
Example:
const adventurer = {
name: 'Alice',
cat: {
name: 'Dinah',
},
};
const dogName = adventurer.dog?.name;
console.log(dogName);
// Expected output: undefined
console.log(adventurer.someNonExistentMethod?.());
// Expected output: undefined
### Description: The ?. operator is like the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined),
the expression short-circuits with a return value of undefined. When used with function calls, it returns undefined if the given function does not exist.
###
By using the ?. operator instead of just ., JavaScript knows to implicitly check to be sure obj.first is not null or undefined
before attempting to access obj.first.second. If obj.first is null or undefined, the expression automatically short-circuits, returning undefined.
const nestedProp = obj.first?.second;
Documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
Ternary Operator
###Syntax: condition ? exprIfTrue : exprIfFalse
###Description: Besides false, possible falsy expressions are: null, NaN, 0, the empty string (""), and undefined.
If condition is any of these, the result of the conditional expression will be the result of executing the expression exprIfFalse.
### Conditional chains:
The ternary operator is right-associative, which means it can be "chained" in the following way,
similar to an if … else if … else if … else chain:
function example() {
return condition1 ? value1
: condition2 ? value2
: condition3 ? value3
: value4;
}
Documentations: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator
1. The local and remote repositories only interact when you run one of the four network commands in Git: git clone, git fetch, git pull, and git push.
2. You can't create commits without these settings, so set them yourself using your command line application:
git config --global user.name "First Last"
and then enter,
git config --global user.email "you@email.com"
Note: You won't see any confirmation that this worked, but as long as you don't see an error, you're set!
3. Configure autocrlf
Next, we set core.autocrlf (autocrlf stands for auto carriage return line feed). Different systems handle line endings and line breaks differently. If you open a file created on another operating system and do not have this config option set, Git will think you made changes to the file based on the way your operating system handles the line endings.
For Windows users enter:
git config --global core.autocrlf true
4. git checkout myfeaturebranch for swith into myfeaturebranch.
5. Let’s take another look at our repository status: git status.
IMPORTANT =>
1. first checkout (switch branch) 2. git pull (for retrive) 3. git merge origin/RBKQA (for merge all files in current branch) 4. make changes
5. staged your changes 6. commit & push.
Done!
Additional -
git reset --merge => Abort the merge and return to the previous state.
Note:
1. Sometime if you are not using correct feature branch then it will give you error. for merging
Why we test-> To save time, to become better at our craft, and to build better software.
Why we create test data-> Naturally, the data in your production org changes over time and will be different from the data in your developer environment.
When your tests run, either in a developer environment or in production, they have access only to the data in that org.
So if you write tests using existing data, you can end up with deployment problems, because the data available in one environment isn’t always available in another environment.
-> Test.startTest() and Test.stopTest() => Any code between those two calls executes with a refreshed set of governor limits.
Create data-> 3 methods-> TestFactory class, @TestSetup & csv file.
By default, Apex classes are without sharing, meaning they run in "system context" and ignore the current user’s record-level sharing rules, permissions, and field-level security. They have full access to all data, although they still respect organization-wide defaults.
Key Details regarding Default Behavior:
- Without Sharing (Default): If neither
with sharingnorwithout sharingis declared, the class runs in system mode, ignoring user sharing rules. - Inheritance: If an undeclared class is called by a
with sharingclass, it inherits that strict context. - Triggers: Triggers are also
without sharingby default, running in system context. - Security Risk: Because the default is insecure, it is highly recommended to explicitly declare
with sharingto enforce security rules. - AuraEnabled: @AuraEnabled classes can sometimes behave differently, but generally, they follow the same rules, necessitating explicit declaration.

