In this post I will write about some tips on JavaScript Conversion from type to values etc. Tip 1: Boolean values In JavaScript one can use the double not (!!) to convert a variable to a Boolean. What the !! operator (poor man casting) does is, it first cast the data to a true Boolean […]
Tag: tips
Here is another quick tip on JavaScript, the default value in Javascript. If you are coming from the C# world you may have seen something along the line of
1 |
string str = person.FirstName ?? "Unknown"; |
The above code shows the ?? for null coalescing operator in C#, don’t confused it by the generic default value. In JavaScript, there is the […]
Here is a quick C# tip of counting up values of a Dictionary<TKey, TValue> where the values contains a List<T> using Linq. Lets say you have a Dictionary that contains Dictionary<string, List<Guid>> and you wish to find out how many items of Guid you have. You can easily do it by the Sum Linq aggregate […]