February 2019
Beginner
694 pages
18h 4m
English
As we saw in Chapter 1, TypeScript - Tools and Framework Options, JavaScript objects and variables can be changed or reassigned on the fly. As an example of this, consider the following JavaScript code:
function doCalculation(a,b,c) {
return (a * b) + c;
}
var result = doCalculation(2,3,1);
console.log('doCalculation():' + result);
Here, we have a doCalculation function that is computing the product of the arguments a and b, and then adding the value of c. We are then calling the doCalculation function with the arguments 2, 3, and 1, and logging the result to the console. The output of this sample would be as follows:
doCalculation():7
This is the expected result as 2 * 3 = 6, and 6 + 1 = 7. Now, let's take a look at what ...
Read now
Unlock full access