- Ask js questions - Ask about css & bootstrap - custom components - knowledge about google maps - knowledge of ng bootstrap - knowledge about cdci - knowledge about micro services - knowledge of docker - diff between json and xml - what is agail methodology - knowledge of strip - how many type of element s there in strip - diff between ssr and csr - what are signals - how can we reduce load of DB of API call - Communication: 2.5/5 - Angular experince: 5.5 years - NodeJS experince: 5.5 years - Worked with AngularJS: No - Angular SSR: No - Custom components: No - knowledge about cdci: No - knowledge of docker: Yes - knowledge of MQTT: No - what is agail methodology: - knowledge of strip: No - Angular 16: Not aware with new feature - Bootstrap: 2.5/5 - ngrx store: No ## Interview Questions https://www.simplilearn.com/tutorials/angular-tutorial/angular-interview-questions - How Angular application start Main.ts is main Entry point of angular compiler, When we fire Command ng serve , the execution comes to main.ts file. and there angular bootstrap or loads default app.module.ts. Then in app.module.ts we bootstrap app.component using bootstrap : [AppComponent] in @NgModule. - What is Ajax - AJAX stands for Asynchronous JavaScript and XML. It is a set of web development techniques that uses various web technologies on the client-side to create asynchronous web applications - ngxs store - Store: The store is a global state manager that dispatches actions your state containers listen to and provides a way to select data slices out from the global state. - Action: Actions can either be thought of as a command which should trigger something to happen, or as the resulting event of something that has already happened. - State: States are classes along with decorators to describe metadata and action mappings. To define a state container, let's create an ES2015 class and decorate it with the State decorator. - Diff between library & framework - Both the framework vs library is precoded support programs to develop complex software applications. - A library is a collection of prewritten code that can be used to simplify tasks. - library: JQuery , React JS - A framework is like a foundation for developers to build applications for a particular platform. - A framework provides tools which can be use directly to make easy development - framework: AngularJS , Spring , NodeJS - What is DOM - document object model - When a web page is loaded, the browser creates a Document Object Model of the page. - A DOM element is something like a DIV, HTML, BODY element on a page. You can add classes to all and add style with respect to added classes using CSS, or interact with them using JS - Types of auth guard - CanActivate, CanActivateChild, CanDeactivate, Resolve and CanLoad - Directives - Angular 8 directives are DOM elements to interact with your application. Generally, directive is a TypeScript function. - Attribute directives - Attribute directives deal with changing the look and behavior of the dom element. You can create your own directives as shown below. - custom directive with style like tooltip ngstyle, ngclass, ngswitch - Structural directives - A structure directive basically deals with manipulating the dom elements. Structural directives have a * sign before the directive - ngif, ngfor, - Component based directives - [abs] - custom created directives - why ngoninit is their when their is constructor is also there - we should use constructor() to set up Dependency Injection, Initialization of class fields, etc. ngOnInit() is a better place to write “actual work code” that we need to execute as soon as the class is instantiated. - what is es6 features - let and const Keywords - Arrow Functions - const sum = (a, b) => { return a + b } - Multi-line Strings - `

${user.name}

${user.title}

` - Default parameters - Promises - The Promise represents the completion of an asynchronous operation. It returns a single value based on the operation being rejected or resolved pending: This is the default state of a defined promise fulfilled: This is the state of a successful promise rejected: This is the state of a failed promise var promise = new Promise((resolve, reject) => { resolve("Promise Resolved"); }) promise.then((success) => { console.log(success); }) .catch(function(error) => { console.log(error); }); - Classes - Modules - Use of transform in css - The transform CSS property lets you rotate, scale, skew, or translate an element. EX: transform: rotate(20deg); - use when background-img used from css means img path added in css file - background-size: 300px 150px; - single tone services - A singleton service is a service for which only one instance exists in an application - the preferred way to create a singleton service is to set providedIn to root on the service's @Injectable() decorator. This tells Angular to provide the service in the application root or Declare service in the providers’ array of @ngModule. - Concept of services in angular - let you define code or functionalities that are then accessible and reusable in many other components in your Angular project - Global variable in angular - Using @Injectable() in class and declare in providers and than just import where u want to use, create component with class and declare variable using export and u can use anywhere in component by import - What is injectable - The @Injectable() decorator defines a class as a service in Angular and allows Angular to inject it into a component as a dependency. - what is tls files in angular - No idea - closer and inner function - Inner function EX: one function add inside another function function init() { var name = 'Mozilla'; // name is a local variable created by init function displayName() { // displayName() is the inner function, a closure console.log(name); // use variable declared in the parent function } displayName(); } init(); - Clouser ex: displayName() inner function is returned from the outer function before being executed. function makeFunc() { const name = 'Mozilla'; function displayName() { console.log(name); } return displayName; } const myFunc = makeFunc(); myFunc(); - subject - A subject is an observable that can multicast i.e. talk to many observers - behavior subject - A BehaviorSubject holds one value. When it is subscribed it emits the value immediately. A Subject doesn't hold a value. - hot vs cold observable - When the data is produced by the Observable itself, we call it a cold Observable. When the data is produced outside the Observable, we call it a hot Observable. - Cold observable EX const observable = Rx.Observable.create((observer) => { observer.next(Math.random()); }); - Hot observable EX const random = Math.random() const observable = Rx.Observable.create((observer) => { observer.next(random); }); - what is ngrx - Ngrx is a group of Angular libraries for reactive extensions. Ngrx/Store implements the Redux pattern using the well-known RxJS observables of Angular 2. - What are Single Page Applications (SPA)? - Single page applications are web based applications that only need to be loaded once, with new functionality consisting of only minor changes to the user interface. It does not load new HTML pages to display the content of the new page - What is data binding in Angular? - Data binding is one of the most significant and effective elements for creating communication between the DOM and the component. There are Four types of Data binding in Angular: Property Binding Event Binding String Interpolation Two way data binding - Property Binding: One method of data binding is called property binding. In property binding, we connect a DOM element's property to a field that is a declared property in our TypeScript component code. In reality, Angular transforms string interpolation into property binding internally. - Event Binding: Using event binding, you may respond to DOM events like button clicks and mouse movements. When a DOM event (such as a click, change, or keyup) occurs, the component's designated method is called. 1. What is Angular? - Angular is an open-source, JavaScript framework wholly written in TypeScript. It uses HTML's syntax to express your application's components clearly. 2. Why were client-side frameworks like Angular introduced? - web developers used VanillaJS and jQuery to develop dynamic websites but, as the logic of one's website grew, the code became more and more tedious to maintain. - client-side frameworks like Angular came into the picture, which made life easier for the developers by handling separation of concerns and dividing code into smaller bits of information 3. What is TypeScript? - TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript - TypeScript is a primary language for Angular application development. It is a superset of JavaScript with design-time support for type safety and tooling. Browsers can't execute TypeScript directly. 4. What are Templates in Angular? - Angular Templates are written with HTML that contains Angular-specific elements and attributes. In combination with the model and controller's information, these templates are further rendered to provide a dynamic view to the user. 5. What are Components in Angular? - Components are the basic building blocks of the user interface in an Angular application. Every component is associated with a template and is a subset of directives. 6. What are some of the advantages of Angular over other frameworks? - Angular provides a number of built-in features like,routing, state management, rxjs library and http servicesstraight out of the box. This means that one does not need tolook for the above stated features separately. They are allprovided with angular. - Angular uses HTML to render the UI of an application. HTML isa declarative language and is much easier to use than JavaScript. - Google announced Long-term support for Angular. This means that Google plans to stick with Angular and further scale up its ecosystem. 7. What is AOT compilation? What are the advantages of AOT? - Every Angular application consists of components and templates which the browser cannot understand. Therefore, all the Angular applications need to be compiled first before running inside the browser. - Angular provides two types of compilation: - JIT(Just-in-Time) compilation - this is default - AOT(Ahead-of-Time) compilation - need to add with --aot - JIT vs AOT - JIT is more suitable for development mode. & AOT is much suitable in the case of Production mode. - JIT downloads the compiler and compiles code exactly before Displaying in the browser. -> AOT has already complied with the code while building your application, so it doesn’t have to compile at runtime. - Loading in JIT is slower than the AOT because it needs to compile your application at runtime. -> Loading in AOT is much quicker than the JIT because it already has compiled your code at build time. 58 Modules - A module is a place where we can group components, directives, services, and pipes. Module decides whether the components, directives, etc can be used by other modules, by exporting or hiding these elements. Every module is defined with a @NgModule decorator. 9. How does an Angular application work? - Every Angular app consists of a file named angular.json. This file will contain all the configurations of the app. While building the app, the builder looks at this file to find the entry point of the application. Following is an image of the angular.json file: "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/angular-starter", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "aot": false, "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", "src/style.css" ] } } websocket API in html: - Inside the build section, the main property of the options object defines the entry point of the application which in this case is main.ts. - The main.ts file creates a browser environment for the application to run, and, along with this, it also calls a function called bootstrapModule, which bootstraps the application. These two steps are performed in the following order inside the main.ts file: import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; platformBrowserDynamic().bootstrapModule(AppModule) - In the above line of code, AppModule is getting bootstrapped. - The AppModule is declared in the app.module.ts file. This module contains declarations of all the components. 10. What are lifecycle hooks in Angular? Explain a few lifecycle hooks. - Contstructor - ngOnChange - ngOnInit - ngDoCheck - ngAfterContentInit - ngAfterContentChecked - ngAfterViewInit - ngAfterViewChecked - ngOnDestroy 11. Explain string interpolation and property binding in Angular. - String Interpolation in Angular 8 is a one-way data-binding. - Data-binding is a feature in angular, which provides a way to communicate between the component(Model) and its view(HTML template). - Data-binding can be done in two ways, one-way binding and two-way binding. 12. How are observables different from promises? promise vs observable - Emits a single value -> Emits multiple values over a period of time - Not Lazy -> Lazy. An observable is not called until we subscribe to the observable - Cannot be cancelled -> Can be cancelled by using the unsubscribe() method 13. Explain MVVM architecture - (15) https://www.interviewbit.com/angular-interview-questions/ - we update anything in view, it gets updated in model, change anything in model, it shows up in view, which is what we call 2-way binding. 12. What are decorators in Angular? - Decorators are design patterns used to isolate the modification or decoration of a class without modifying the source code. - In AngularJS, decorators are functions that allow a service, directive or filter to be modified prior to its usage. - Class decorators, such as @Component and @NgModule - Property decorators for properties inside classes, such as @Input and @Output - Method decorators for methods inside classes, such as @HostListener - Parameter decorators for parameters inside class constructors, such as @Inject 15. What are Pipes in Angular? - Pipes are simple functions designed to accept an input value, process, and return as an output, a transformed value in a more technical understanding 16. What is an ngModule? - NgModules are containers that reserve a block of code to an application domain or a workflow. @NgModule takes a metadata object that generally describes the way to compile the template of a component and to generate an injector at runtime. 17. What is view encapsulation in Angular? - View encapsulation defines whether the template and styles defined within the component can affect the whole application or vice versa. Angular provides three encapsulation strategies: - Emulated - styles from the main HTML propagate to the component. - Native - styles from the main HTML do not propagate to the component. - None - styles from the component propagate back to the main HTML and therefore are visible to all components on the page. https://codecraft.tv/courses/angular/components/templates-styles-view-encapsulation/ 18. what is rxjs - RxJS is a library for composing asynchronous and event-based programs by using observable sequences. It provides one core type, the Observable, satellite types (Observer, Schedulers, Subjects) and operators inspired by Array#extras (map, filter, reduce, every, etc) to allow handling asynchronous events as collections. 19. rxjs - Observable: Observable in Angular is a feature that provides support for delivering messages between different parts of your single-page application. - Observer: An Observer is a consumer of values delivered by an Observable, is a collection of callbacks that knows how to listen to values delivered by the Observable. (onNext, onError, onComplete) - Subscription: represents the execution of an Observable, is primarily useful for cancelling the execution. - Operators: are pure functions that enable a functional programming style of dealing with collections with operations like map, filter, concat, reduce, etc. - Subject: is equivalent to an EventEmitter, and the only way of multicasting a value or event to multiple Observers. - Schedulers: are centralized dispatchers to control concurrency, allowing us to coordinate when computation happens on e.g. setTimeout or requestAnimationFrame or others. 20. redux - Redux is a JavaScript library for managing application state. - Store - The store is a single JS object that contains state of application. - The store is a single JS object. To create a store you simple need to a add a TypeScript file to the project and declare a new interface type which contains all the properties you’d like to keep in the store. - Actions - Actions are the only source of information for the store as per Redux official documentation. It carries a payload of information from your application to store. - Reducers - A reducer is a function that specifies how the state changes in response to an action. - What’s important to understand is the fact that a reducer function does not modify the state. It always returns a new state object with the modifications included. 21. diff between d-none and visibility:hidden - display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). ... visibility:hidden means that unlike display:none, the tag is not visible 22. Difference between TypeScript and JavaScript: - TypeScript is known as an Object-oriented programming language whereas JavaScript is a scripting language. - TypeScript has a feature known as Static typing but JavaScript does not support this feature. - TypeScript supports Interfaces but JavaScript does not. 23. Dependency injection - is a design pattern in which a class requests dependencies from external sources rather than creating them - Types of Dependency Injection in Angular - Constructor injection: Here, it provides the dependencies through a class constructor. - Setter injection: The client uses a setter method into which the injector injects the dependency. - Interface injection: The dependency provides an injector method that will inject the dependency into any client passed to it. On the other hand, the clients must implement an interface that exposes a setter method that accepts the dependency. 24. async pipes - The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted. When a new value is emitted, the async pipe marks the component to be checked for changes. When the component gets destroyed, the async pipe unsubscribes automatically to avoid potential memory leaks. 25. what is observable - Observable in Angular is a feature that provides support for delivering messages between different parts of your single-page application. 26. why tsconfig.json is there in angular project - The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project. The tsconfig. json file specifies the root files and the compiler options required to compile the project. 27. let and var diff - let is block-scoped. -> var is function scoped. - Variables defined without let can be redeclared. -> Variables defined with let can not be redeclared. - declared inside a { } block cannot be accessed from outside -> declared inside a { } block can be accessed from outside - let must be declare before use -> "" 28. Why TypeScript is developed while having JavaScript? When JavaScript was developed, the JavaScript development team introduced JavaScript as a client-side programming language. But as people were using JavaScript, developers also realized that JavaScript could be used as a server-side programming language. However, as JavaScript was growing, JavaScript code became complex and heavy. Because of this, JavaScript wasn’t even able to fulfill the requirement of an Object-Oriented Programming language. This prevented JavaScript from succeeding at the enterprise level as a server-side technology. So TypeScript was created by the development team to bridge this gap. - code is written in JavaScript can be converted to TypeScript by changing the extension from .js to .ts. - TypeScript can be compiled to run on any browser, device, or operating system. TypeScript is not specific to any single environment. - TypeScript is known as an Object-oriented programming language whereas JavaScript is a scripting language. 29. What's the Router Outlet in Angular? The router-outlet is a directive that's available from the @angular/router package and is used by the router to mark where in a template, a matched component should be inserted. Thanks to the router outlet, your app will have multiple views/pages and the app template acts like a shell of your application. Any element, you add to the shell will be rendered in each view, only the part marked by the router outlet will be changed between views. 30. What are Annotations in Angular? Annotations in Angular are used for creating an annotation array. They are the metadata set on the class that is used to reflect the Metadata library. 31. What is the PipeTransform interface? As the name suggests, the interface receives an input value and transforms it into the desired format with a transform() method. It is typically used to implement custom pipes. import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'demopipe' }) export class DemopipePipe implements PipeTransform { transform(value: unknown, ...args: unknown[]): unknown { return null; } } 32. What are filters in Angular? Name a few of them. Filters are used to format an expression and present it to the user. They can be used in view templates, controllers, or services. Some inbuilt filters are as follows. date - Format a date to a specified format. filter - Select a subset of items from an array. Json - Format an object to a JSON string. limitTo - Limits an array/string, into a specified number of elements/characters. lowercase - Format a string to lowercase. 33. Explain the @Component Decorator. TypeScript class is one that is used to create components. This genre of class is then decorated with the "@Component" decorator. The decorato’s purpose is to accept a metadata object that provides relevant information about the component. 34. What is Eager and Lazy loading? Eager loading is the default module-loading strategy. Feature modules under Eager loading are loaded before the application starts. This is typically used for small size applications. Lazy loading dynamically loads the feature modules when there's a demand. This makes the application faster. It is used for bigger applications where all the modules are not required at the start of the application. 35. what is eagerly loaded module modules are eagerly loaded which means that they are all loaded when the application launches. 36. What is style mining 37. What is diff between JS expression and Angular expression getter & setter method map() will return a new array as per the conditions applied. - modification of array forEach() will not return anything. forEach() returns undefined. filter()method will return an array of matching elements else will return an empty array if no matching happens. - get new array filtered value https://www.besanttechnologies.com/angular-8-interview-questions-answers https://www.interviewbit.com/angular-8-interview-questions/ angular universal - single tone service - A singleton service is a service for which only one instance exists in an application. access modifiers in typescript Public, Private, Protected 1. What is Angular? 2. Why were client-side frameworks like Angular introduced? 3. What is TypeScript? 4. What are Templates in Angular? 5. What are Components in Angular? 6. What are some of the advantages of Angular over other frameworks? 7. What is AOT compilation? What are the advantages of AOT? 10. What are lifecycle hooks in Angular? Explain a few lifecycle hooks. 12. How are observables different from promises? 12. What are decorators in Angular? 15. What are Pipes in Angular? 17. What is view encapsulation in Angular? 20. redux 21. diff between d-none and visibility:hidden 23. Dependency injection 25. what is observable - How can we print nested array in html - what is recursive function - How can we use multiple css in 1 component - How to use multiple bootstrap in angular application - What is use of view child - How can we show html of 1 component to another component -> - what is ? can we use multiple router outlate in application - when ngAfterContentChecked call in lifecycle - ngAfterContentChecked() It gets called after ngAfterContentInit and every subsequent ngDoCheck. It responds after the projected content is checked. - what is event emmiter - If used input method and i want on every time input value change done some proccess what i can use for it - How display flex work? which css property use for shows in multiple line - What is reactive form and template driven form - What is Transpiling in Angular? -> convert typescript to javascript - meta data in angular - Metadata is attached to classes using decorators. Decorators are special functions that are used to add metadata to classes. - Javascript datatypes - Primitive & non primitive - primitive: string, number, Boolean, undefined, null - non: object, array - Pure and impure pipes - Step for boostup angular application Dynamic components ng-template use Pure pipes are preferred: To improve performance, use pure pipes and only call them when the input changes. view child use to get reference on child component https://www.angularminds.com/blog/how-to-build-micro-front-ends-using-module-federation-in-angular retry method of rxjs Module Federation allows developers to combine separate apps into one Angular application where each separate app is loaded through lazy loading. https://vibhas1892.medium.com/difference-between-ng-template-ng-container-and-ng-content-a1d264619655 What is the purpose of Ngzone in Angular? The most common use of this service is to optimize performance when starting a work consisting of one or more asynchronous tasks that don't require UI updates or error handling to be handled by Angular. providers and provide in https://stackoverflow.com/questions/63113192/how-to-retry-a-subscription-when-it-fails-in-angular-9 fork join forkJoin allows you to wait for multiple Observables to complete and then emit their latest values as an array. ------------------------------------------------------------------------------------------------------------------------ HTML Questions: 1. The tag is required for HTML5 2. Web socket in html: - WebSockets allow bidirectional communication which means both client and server can send data to eachother independently and simultaneously - we can send data from browser to server by calling a send() method - var Socket = new WebSocket(url, [protocol] ); - A value of 0 indicates that the connection has not yet been established. - A value of 1 indicates that the connection is established and communication is possible. - A value of 2 indicates that the connection is going through the closing handshake. - A value of 3 indicates that the connection has been closed or could not be opened. -------------------------------------------------------------------------------------------------------------------------- ## Interview practical https://www.fullstack.cafe/blog/javascript-code-interview-questions - Second highest value find from array - https://stackoverflow.com/questions/17039770/how-do-i-get-the-second-largest-element-from-an-array-in-javascript - [1,2,5,3,2,6,3,2,7,4,8] -> prepare array like [1,2,3,4,5,6,7,8,1,2,3,2,3] - Get the element with the highest reapted in an array - https://stackoverflow.com/questions/1053843/get-the-element-with-the-highest-occurrence-in-an-array - Even numbers get from array practical const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; const even = arr.filter(number => { return number % 2 === 0; }); - Odd numbers get from array practical const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; const odds = arr.filter(number => { return number % 2 !== 0; }); - Which condition will true a = [1,2,3]; b = [1,2,3]; c = '1,2,3'; a==c -> true a==b b==c - Explain what a callback function is: - A callback function is a function that is passed to another function as an argument and is executed after some operation has been completed. Below is an example of a simple callback function that logs to the console after some operations have been completed. - function modifyArray(arr, callback) { // do something to arr here arr.push(100); // then execute the callback function that was passed callback(); } var arr = [1, 2, 3, 4, 5]; modifyArray(arr, function() { console.log("array has been modified", arr); }); - Given a string, reverse each word in the sentence var string = "Welcome to this Javascript Guide!"; // Output becomes !ediuG tpircsavaJ siht ot emocleW var reverseEntireSentence = reverseBySeparator(string, ""); // Output becomes emocleW ot siht tpircsavaJ !ediuG var reverseEachWord = reverseBySeparator(reverseEntireSentence, " "); function reverseBySeparator(string, separator) { return string.split(separator).reverse().join(separator); } - How would you check if a number is an integer? function isInt(num) { return num % 1 === 0; } console.log(isInt(4)); // true console.log(isInt(12.2)); // false console.log(isInt(0.3)); // false - Write a function that would allow you to do this => multiply(5)(6); - function multiply(a) { return function(b) { return a * b; } } multiply(5)(6); - Find second highest value from array var secondMax = function (arr) { var max = Math.max.apply(null, arr); // get the max of the array arr.splice(arr.indexOf(max), 1); // remove max from the array return Math.max.apply(null, arr); // get the 2nd max }; var arr = [20, 120, 111, 215, 54, 78]; // use int arrays var max2 = secondMax(arr); console.log(max2); - Prime number function test_prime(n) { if (n===1) { return false; } else if(n === 2) { return true; }else { for(var x = 2; x < n; x++) { if(n % x === 0) { return false; } } return true; } } console.log(test_prime(37)); --------------------------------------------------------------- React JS interview questions ---------------------------------------------------------------------------------- 1. What are hooks - Hooks are functions that let you “hook into” React state and lifecycle features from function components. 2. names of hooks - useState, -> used for manage state - useEffect, -> Used for call functions, manage values at the time of render component - useContext, -> Share data to multi level component - useReducer, -> Reducer read the payloads from the actions and then updates the store via the state accordingly - useRef, -> For get ref of element - useMemo, -> return memories values - useCallback -> it calls when dependencies value update 3. What is lazy loading and where should it be used? - Lazy loading is one of the most common design patterns used in web and mobile development. It is widely used with frameworks like Angular and React to increase an application's performance by reducing initial loading time. 4. what is redux in react js - Redux is an open-source JavaScript library for managing and centralizing application state. It is most commonly used with libraries such as React or Angular for building user interfaces. - STORE: A Store is a place where the entire state of your application lists. It manages the status of the application and has a dispatch(action) function. It is like a brain responsible for all moving parts in Redux. - ACTION: Action is sent or dispatched from the view which are payloads that can be read by Reducers. It is a pure object created to store the information of the user's event. It includes information such as type of action, time of occurrence, location of occurrence, its coordinates, and which state it aims to change. - REDUCER: Reducer read the payloads from the actions and then updates the store via the state accordingly. It is a pure function to return a new state from the initial state. 5. What is a Layout Route in React Router - A layout route is a parent route WITHOUT a path prop. It does not have a path prop because it is not used to render an element when the path pattern matches the current URL. Instead, It is used exclusively to group child routes inside a specific layout. - it is work like router outlet 6. What is the use of this.props.children - It is used to send anything between components open and close tag // this btn is children for greet component 7. what is the use of refs in react - Refs provide a way to access DOM nodes or React elements created in the render method. - get ref of dom element 8. What is state ? - The state is a built-in React object that is used to contain data or information about the component. 9. Props are immutable, while state is mutable - props value can not change - state value we can change 10. Real DOM == Virtual DOM It is an abstraction of a page's HTML. == It is an abstraction of an HTML DOM. It can manipulate on-screen elements. == It cannot manipulate on-screen elements. Any change updates the entire DOM tree. == Any change only updates the relevant node in the tree. 11. What is Higher Order Components ? - A higher-order component (HOC) is an advanced technique in React for reusing component logic. - for make logic common and share with other component 12. What is array destructuring ? - Destructuring is a convenient way of creating new variables by extracting some values from data stored in objects or arrays. 13. what is callback function in react - callback functions like event handlers inside a component are re-created as unique function objects at every re-render of the component. When a callback is passed from a parent to a child as a prop, the child component re-renders just because of the absence of referential integrity of the callback. 14. what is usememo in react - The React useMemo Hook returns a memoized value. Think of memoization as caching a value so that it does not need to be recalculated. 15. What is react React is a JavaScript library created by Facebook React is a User Interface (UI) library React is a tool for building UI components 16. What is Babel? - Babel is a JavaScript compiler that can translate markup or programming languages into JavaScript. 17. What is JSX? JSX stands for JavaScript XML. JSX is an XML/HTML like extension to JavaScript. 18. React DOM Render - The method ReactDom.render() is used to render (display) HTML elements: 19. ------------------------------------------------------------------ Nodejs interview questions ---------------------------------------------------------------------------------- 1. What is Node.js? Where can you use it? - Node.js is an open-source, cross-platform JavaScript runtime environment and library to run web applications outside the client’s browser. It is used to create server-side web applications. 2. Why is Node.js Single-threaded? - Node.js is single-threaded for async processing. By doing async processing on a single-thread under typical web loads, more performance and scalability can be achieved instead of the typical thread-based implementation. 3. what is single threaded - Single threaded processes contain the execution of instructions in a single sequence. In other words, one command is processes at a time. 4. Explain callback in Node.js. - A callback function is called after a given task. It allows other code to be run in the meantime and prevents any blocking. Being an asynchronous platform 5. What is NPM? - NPM stands for Node Package Manager, responsible for managing all the packages and modules for Node.js. 6. What is the purpose of the module .Exports? - In Node.js, a module encapsulates all related codes into a single unit of code that can be parsed by moving all relevant functions into a single file. You may export a module with the module and export the function 7. What are some of the most commonly used libraries in Node.js? There are two commonly used libraries in Node.js: ExpressJS - Express is a flexible Node.js web application framework that provides a wide set of features to develop web and mobile applications. Mongoose - Mongoose is also a Node.js web application framework that makes it easy to connect an application to a database. 8. What is the command used to import external libraries? - The “require” command is used for importing external libraries. For example - “var http=require (“HTTP”).” This will load the HTTP library and the single exported object through the HTTP variable. 9. What is an Event Loop in Node.js? - Event loops handle asynchronous callbacks in Node.js. It is the foundation of the non-blocking input/output in Node.js, making it one of the most important environmental features. 10. What is an EventEmitter in Node.js? EventEmitter is a class that holds all the objects that can emit events Whenever an object from the EventEmitter class throws an event, all attached functions are called upon synchronously 11. What are the two types of API functions in Node.js? The two types of API functions in Node.js are: Asynchronous, non-blocking functions Synchronous, blocking functions 12. What is the Express.js package? - Express is a flexible Node.js web application framework that provides a wide set of features to develop both web and mobile applications 13. What are streams in Node.js? Streams are objects that enable you to read data or write data continuously. There are four types of streams: Readable – Used for reading operations Writable − Used for write operations Duplex − Can be used for both reading and write operations Transform − A type of duplex stream where the output is computed based on input 14. What is REPL in Node.js? - REPL stands for Read Eval Print Loop, and it represents a computer environment. It’s similar to a Windows console or Unix/Linux shell in which a command is entered. Then, the system responds with an output ------------------------------------------------------------------ Javascript interview questions ---------------------------------------------------------------------------------- 1. What exactly do you know about JavaScript? - It is basically an object-oriented programming language that is having a lot of applications. It can be used for both server-side, as well as client-side scripting and the good thing is it is known to provide the best results in every aspect. When it comes to building HTML WebPages, this language is often considered and is known to bring the most desired outcomes. 2. Can we run javascript server side? - Yes 3. How many data types are there in JavaScript? Can you name them? - Function, String, Undefined, Number, Boolean, Object 4. what is class? - A class is a blueprint for creating an object, we call that created object an instance of a class - We instantiate a class by using the new keyword and when that happens javascript calls the constructor function. 5. Diff between var and let 6. What is the purpose of ‘This’ operator in JavaScript? 7. What is Callback? 8. What is Closure? 9. what is the use of "Type Of" operator 10. diff between session storage and local storage 11. What is the difference between null & undefined? - Undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment value. It can be assigned to a variable as a representation of no value. Also, undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object. 12. How do JavaScript primitive/object types passed in functions? - One of the differences between the two is that Primitive Data Types are passed By Value and Objects are passed By Reference. By Value means creating a COPY of the original. Picture it like twins: they are born exactly the same, but the first twin doesn’t lose a leg when the second twin loses his in the war. By Reference means creating an ALIAS to the original. When your Mom calls you “Pumpkin Pie” although your name is Margaret, this doesn’t suddenly give birth to a clone of yourself: you are still one, but you can be called by these two very different names. 13. What will be the output of the following code? var X = { Foo : 1}; var Output = (function() { delete X.foo; return X.foo; } )(); console.log(output); output: undefined 14. what is promise? 15. What is Ajax - Ajax is an acronym for Asynchronous JavaScript and XML. It is a group of inter-related technologies like JavaScript, DOM, XML, HTML/XHTML, CSS, XMLHttpRequest etc. - AJAX allows you to send and receive data asynchronously without reloading the web page