5 Best Ruby on Rails Gems You Need in 2021
Check Angular Version
Check your Angular Version
You can check your Angular and Angular CLI version using the following command,
ng --version
It should give you a detailed info about your Angular and related software versions.
Angular CLI: 12.1.0
Node: 14.17.1
Package Manager: npm 6.14.13
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1201.0 (cli-only)
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@schematics/angular 12.1.0 (cli-only)
Check Any Value in Array Satisfy Condition | JavaScript
How to Check Any Value in Array Satisfy Condition Using JavaScript ?
To check if any value in JavaScript array satisfies the condition you can use Array.prototype.some()
method. It returns true
if any item in array satisfies the condition else returns false
.
let data = [1,2,3,4,5,7];
let val = data.some(item => item > 6);
if(val){
console.log('Numbers found greater than 6 ');
} else{
console.log('No Numbers greater than 6 ');
}
// - "Numbers found greater than 6 "
Check Every Value in Array Satisfy Condition | JavaScript
How to Check Every Value in Array Satisfy Condition Using JavaScript ?
To check every value in JavaScript array you can use Array.prototype.every()
method. It returns true
if each item in array satisfies the condition else false
.
let data = [1,2,3,4,5];
let val = data.every(item => item < 6);
if(val){
console.log('Numbers less than 6 ');
} else{
console.log('Numbers greater than 6 ');
}
// "Numbers less than 6 "
Concatenate String JavaScript
Convert Date to UTC | JavaScript
How to convert date to UTC format in JavaScript?
new Date()
will give you the current date and time in JavaScript. To convert the local date and time to UTC string format you can make use of the toUTCString()
method.
let currentDate = new Date();
let utc = currentDate.toUTCString();
console.log(utc);
// "Mon, 26 Jul 2021 18:23:10 GMT"
Convert String Number to Number Int | JavaScript
Convert String Number to Number in JavaScript ?
You can make use of the unary plus(+)
operator to convert string number to number.
let strNum = "1000";
let num = +strNum;
console.log(num);
// 1000
Convert to LowerCase | Jekyll | Liquid
To convert string to lowercase in Jekyll, you can use a filter called downcase
{{'hello' | downcase}}
Convert to UpperCase | Jekyll | Liquid
To convert string to uppercase in Jekyll, you can use a filter called upcase
{{'hello' | upcase}}