Search This Blog

Q31-Q35

Q31. When will you choose angular over MVC in your project? 
Q32. What is the difference between var and let keyword? Give o/p of below 
function(){
var a = 'apple';
var a = 'banana';
 console.log(a);
 }
What will be the output if we use let instead of var in above? or Can we use var for same variable name twice? and Can we use let for same variable twice?
Q33.  What are the advantages of using Typescript? We can use ES6 javascript for all the work why still we need typescript? What are the differences between typescript and javascript?
Q34. What is type checking in Typescript? is it run time or compile time?
Q35. Difference between webpack and npm build?

=======================================================================



=======================================================================
Q32. What is the difference between var and let keyword? Give o/p of below 
function(){
var a = 'apple';
var a = 'banana';
 console.log(a);
 }
What will be the output if we use let instead of var in above? or Can we use var for same variable name twice? and Can we use let for same variable twice?

Answer:
This is the drawback of Var keyword. you can have same variable name with var keyword and there will be no error even when both variable are in same scope. 
We can not use LET keyword for same variable name. it will give error if both are in same scope. 

=======================================================================
Q33.  What are the advantages of using Typescript? We can use ES6 javascript for all the work why still we need typescript? What are the differences between typescript and javascript?

Answer:
1. type checking : TypeScript can help us to avoid painful bugs that developers commonly run into when writing JavaScript by type checking the code.
2. Supports static typing and we get features like autocompletion, intellisense etc. 
3. TypeScript gives us all the benefits of ES6 (ECMAScript 6), plus more productivity
4. TypeScript is easier than Javascript while scripting. TypeScript simplifies JavaScript code, making it easier to read and debug.
5. TypeScript latest Javascript concept of classes, modules, interfaces etc. 

=======================================================================
Q34. What is type checking in Typescript? is it run time or compile time?

Answer:
Typechecking make sure that the type of data you have given to your variable will remain same whenever you assign any value to it. it means if you declare a variable of type int it will remain as int and will not accept string. 

Typescript typechecking helps in reducing lots of error which will be seen at run time without tyepchecking because those error are prompted at compile time. 

=======================================================================
Q35. Difference between webpack and npm build?

Answer:
Webpack is a module bundler for javascript projects. you can install webpack using command npm install webpack. 

npm build is a command to create a build.
Grunt, yarn, gulp are few more javascript module bundler tools. 


=======================================================================


No comments:

Post a Comment