Mindblown: a blog about philosophy.
-
JavaScript for C# developers…
-
Difference between var and let keyword in JavaScript in calling asynchronous functions
Consider below code snippet – it just has couple of for loops. Everything is same except for the fact that the first for loop uses ‘var’ keyword and second for loop uses ‘let’ keyword. Would there be any difference in ‘console.log’ statements between first loop and second loop? Take your time and answer. Answer: The…
-
Difference between calling a function with new keyword and without new keyword in JavaScript
JavaScript is so flexible, and it allows you to call the same function in different manners. You can call the same function with ‘new’ keyword and without ‘new’ keyword. You can call the same function through an object and not through an object. How you call the function matters a lot and JavaScript would provide…
-
Asynchronous JS – JavaScript for C# developers
Below content is an excerpt from my book – “JavaScript for C# developers“. Consider the below code snippet, which has just 3 statements and seems to be simple but it is worth analysing it to understand how javascript works with respect to execution of asynchronous code. During the execution phase, JavaScript engine starts executing your code…
-
Function Scope in JavaScript – JavaScript for C# developers
Below content is an excerpt from my book – “JavaScript for C# developers“. Scope in javascript works completely different from how it works in C#. In javascript, we have both block scope and function scope. However, the predominant scope used in javascript is function scope till ES5. We would discuss later in this chapter about the rules which javascript…
-
Arrow functions in JavaScript – JavaScript for C# developers
Below content is an excerpt from my book – “JavaScript for C# developers“. Starting from ES6, there is a new way to declare a function in javascript – Arrow functions. This is similar to the function expression in ES5 but has a concise syntax. Despite the fact that both constructs – functions in ES5 and arrow functions from…
-
How value of ‘this’ is evaluated in JavaScript – Part 2
Below content is an excerpt from my book – “JavaScript for C# developers“. In the last blog post, we’ve discussed how the value of ‘this’ is evaluated in below scenarios Invocation of function through object Invocation of function directly (without any object) If you’ve not read that blog post, I recommend you to read that…
-
How value of ‘this’ is evaluated in JavaScript – Part 1
Below content is an excerpt from my book – “JavaScript for C# developers“. As with many things in javascript, the evaluation of the value of ‘this’ keyword in JavaScript is completely different from how it is done in C#. Before discussing about how JS engine evaluates the value of ‘this’ keyword in javascript, let us revisit how ‘this’ works in C#. Consider the below…
-
$ symbol in jQuery (and in javascript)
Before discussing about the functionality of ‘$’ in jQuery, let us take a look at what it( $ sign) means with respect to JavaScript, as a language. With respect to javaScript, $ symbol is just a valid identifier. Consider the following code snippet $ = 5; console.log($); The above code snippet would just print number…
-
var in C#
Using var keyword, you can declare and initialize variable of any type. By the initialization value, the type of variable (created using ‘var’ keyword) would be decided. Let us see an example var varString = “Hello World”; var varInt = 32; Console.WriteLine(varString.GetType()); // Will print System.String Console.WriteLine(varInt.GetType()); // Will print System.Int32 In the above code snippet, we are declaring couple of variables varString, varInt and assigning string value (“Hello World”) ,…
Got any book recommendations?