Amara  Legros

Amara Legros


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.


const username = null ?? 'suprabha';
// suprabha


1. Nullish coalescing operator (??)

2. “&&” or “||”

3. Falsy Value

4. No chaining with “&&” or “||” operators

5. Browser Support

6. Reference

As you know “&&” or “||” operators are used to handle ‘truthy’ and ‘falsy’ values.

Falsy value in JavaScript:

  • null
  • undefined
  • 0
  • NaN
  • false
  • “ “

“&&” or “||” operators work well with null or undefined values, but many false values can produce unexpected results.

Let’s take an example, here we want to process the response where value is 0(zero). So when you get the response which is falsy, so it will return the right-hand side value.

#beginner #javascript #es6 #js #front-end-development

What is GEEK

Buddha Community

Nullish coalescing operator (??)
Ray  Patel

Ray Patel


Ternary operator in Python?

  1. Ternary Operator in Python

What is a ternary operator: The ternary operator is a conditional expression that means this is a comparison operator and results come on a true or false condition and it is the shortest way to writing an if-else statement. It is a condition in a single line replacing the multiline if-else code.

syntax : condition ? value_if_true : value_if_false

condition: A boolean expression evaluates true or false

value_if_true: a value to be assigned if the expression is evaluated to true.

value_if_false: A value to be assigned if the expression is evaluated to false.

How to use ternary operator in python here are some examples of Python ternary operator if-else.

Brief description of examples we have to take two variables a and b. The value of a is 10 and b is 20. find the minimum number using a ternary operator with one line of code. ( **min = a if a < b else b ) **. if a less than b then print a otherwise print b and second examples are the same as first and the third example is check number is even or odd.

#python #python ternary operator #ternary operator #ternary operator in if-else #ternary operator in python #ternary operator with dict #ternary operator with lambda

Abdullah  Kozey

Abdullah Kozey


Unformatted input/output operations In C++

In this article, we will discuss the unformatted Input/Output operations In C++. Using objects cin and cout for the input and the output of data of various types is possible because of overloading of operator >> and << to recognize all the basic C++ types. The operator >> is overloaded in the istream class and operator << is overloaded in the ostream class.

The general format for reading data from the keyboard:

cin >> var1 >> var2 >> …. >> var_n;

  • Here, var1var2, ……, varn are the variable names that are declared already.
  • The input data must be separated by white space characters and the data type of user input must be similar to the data types of the variables which are declared in the program.
  • The operator >> reads the data character by character and assigns it to the indicated location.
  • Reading of variables terminates when white space occurs or character type occurs that does not match the destination type.

#c++ #c++ programs #c++-operator overloading #cpp-input-output #cpp-operator #cpp-operator-overloading #operators

Rahul  Hickle

Rahul Hickle


A Practical Example of Nullish Coalescing

A Practical Example of Nullish Coalescing
Nullish coalescing is a brand new logical operator (??) for the JavaScript programming language. It was released along with a whole slew of other new features on April 2nd this year as part of ECMAScript version 2020 (or ES2020).

#es2020 #nullish-coalescing #javascript-tips #javascript #js

Enos  Prosacco

Enos Prosacco


Optional Chaining and Nullish Coalescing

Optional Chaining and Nullish Coalescing
When we write applications, calling properties or methods on a non-existing object can have fatal consequences for your program. This usually results in a reference error causing our code to crash. You may not always expect this to happen, because you are not always in control of the data you are working with.

#nullish-coalescing #es2020 #optional-chaining #javascript

Laravel 8 CRUD Operation Example

Hello Friend,

As you know Laravel 8 already officially released and today I will show you how to create CRUD operation in laravel 8, I have already perform many CRUD operations in my previous post like CRUD operation in ajax, CRUD operation in laravel 6 etc. So, today I will give you laravel 8 CRUD application example.

Laravel 8 CRUD Operation Example

#laravel #php #laravel 8 crud operation example #crud operation #laravel 8 crud tutorial #crud operation in laravel 8