This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(0 ?? 'Awesome'); // 0 | |
console.log(null ?? 'Awesome'); // Awesome | |
console.log(false ?? 'Awesome'); // false | |
console.log(undefined ?? 'Awesome'); // Awesome | |
console.log(NaN ?? 'Awesome'); // NaN | |
console.log('' ?? 'Awesome'); // | |
console.log(0n ?? 'Awesome'); // 0n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = { | |
volume: 0 | |
}; | |
const volume = request.volume ?? 1; | |
console.log(volume); | |
// 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = { | |
volume: 0 | |
}; | |
const volume = request.volume ?? 1; | |
console.log(volume); | |
// 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = { | |
volume: 0 | |
}; | |
const volume = request.volume ?? 1; | |
console.log(volume); | |
// 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const task = null ?? 'Write a article'; | |
console.log(task); | |
// Write a article |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserRepository | |
{ } | |
class UserController { | |
private $userRepository; | |
public function __construct(UserRepository $repository) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserRepository | |
{ } | |
class UserController { | |
private $userRepository; | |
public function __construct(UserRepository $repository) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserRepository | |
{ } | |
class UserController { | |
private $userRepository; | |
public function __construct(UserRepository $repository) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Repositories\UserRepository; | |
class UserController extends Controller | |
{ | |
/** | |
* The user repository instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = ['amazing', "", null, 666, undefined, 0, false, NaN]; | |
console.log(arr.filter(Boolean)); | |
// [ 'amazing', 666 ] |
NewerOlder