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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
foreach (var arg in args) | |
{ | |
Console.WriteLine(arg); | |
} | |
} | |
} |
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
//Collects performance metrics for HTML documents. | |
performance.getEntries(); | |
performance.getEntriesByType("navigation")[0]; | |
performance.getEntriesByType("navigation")[0].serverTiming[0]; | |
//Collects performance metrics for document-dependent resources. | |
//Stuff like style sheets, scripts, images, et cetera. | |
performance.getEntriesByType("resource")[0]; | |
performance.getEntriesByType("resource")[0].serverTiming[0]; | |
performance.getEntriesByType("resource")[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
console.log(Infinity.toLocaleString()); //∞ | |
console.log(Infinity.toString()); //Infinity |
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(("b" + "a" + + "b" + "a").toLowerCase()); //writes banana to console | |
//Explanation: | |
//The key point is + "b" | |
//+ is 'unary plus operator' that can be used to convert a variable to a number | |
//when "b" is converted to number, its value would be NaN |
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
var numberContent = ~~"1"; | |
var stringContent = ~~"string sample"; | |
var stringContent2 = +"string sample 2"; | |
var booleanContent = !!"false"; | |
console.log(typeof numberContent); //"number" | |
console.log(numberContent); //1 | |
console.log(typeof stringContent); //"number" | |
console.log(stringContent); //0, but should be NaN! | |
console.log(typeof stringContent2); //"number" |
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
var list = [1, 3, null, undefined, 5, "", "not-empty"]; | |
var filtered = list.filter(Boolean); | |
console.log(filtered); |
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(null > 0); //'false' | |
console.log(null == 0); //'false' | |
console.log(null >= 0); //'true'! | |
//Explanation: | |
//https://blog.campvanilla.com/javascript-the-curious-case-of-null-0-7b131644e274 |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var dict = new Dictionary<string, int>(); | |
dict.Add("A", 25); |
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
using System; | |
using System.Linq.Expressions; | |
public class Person | |
{ | |
public int ID { get; set; } | |
public string Name { get; set; } | |
public int Age { get; set; } | |
} |