Posts

Showing posts from September, 2022

What are Web-Services

  Web Services - The services that are available over the internet/web are called web services. service provider - These are companies or individuals  who develops the web s ervice and makes it available over the internet/web. if there is a service provider then there must be service consumer called as client/consumer. If the client wants to talk to the service provider or the server then we need two things  Medium - Http/internet [like Mobile phone] Format - json/xml [it is English language]

what is Arrow function in JavaScript - ES6

  arrow function - It is nothing but same as function expression but short and sweet.

How to execute Javascript in VS code

Image
S1 : install node software s2 : install VS code software s3 : Open VS code editor. Open the extensions windows. Install two software   JavaScript (ES6) snippets Code Runner - By Jun Han s4 : Open new terminal window and type "npm install prompt-sync" --->This is used to prompt user input s5 : Type the JavaScript code as shown in the below screenshot. s6 : There is Run button on the right side of the window. Click on it to run the program. s7:  Console will ask for input from the user, if it is not allowing to edit then do the following open settings and type code runner and then put a check mark on that option. s8: Re-run the program                

Difference between var and let and const keywords in JavaScript - ES6

var - this is function scoped variable. This variable will attach to window object so it is available for the whole page. Same variable name can be re declared every time with different values let - this is blocked scoped ( if, while, for loop) variable. const - this is same as let. Difference is variable values cannot be changed. The name implies it also the same. But we can change properties values of an object declared as const

Understanding callback functions in Javascript - ES6

Callback functions - A callback is a function passed as an argument to another function.  This technique allows a function to call another function.  A callback function can run after another function has finished. we need to understand in JavaScript functions are executed in the order which they are called and not in the order defined. function myFirst () {     console . log ( "Hello" );   }   function mySecond () {     console . log ( "Goodbye" );   }   mySecond ();   myFirst (); /*expected output:   Goodbye   Hello   */ Sometimes you would like to have better control over when to execute a function. Suppose you want to do a calculation, and then display the result. or take the input from the user, process it and then only display the result.   function greeting ( name ) {     console . log ( `Hello, ${ name } ` );   }   function processUserInput ( callback ) {     const name = 'Manjunath' ;     callback ( name );   }   processUserInput ( greeting );

Understanding Function Expression in Javascript - ES6

Image
  Functions - It can be written in three ways in JavaScript. we developers always think of writing it in old ways which is called as 'Function Declaration way' ex :      -It can be also written in variable assignment way. This is called 'Function expression'    ex:                                           The main difference between a function expression and a function declaration is the function name, which can be omitted in function expressions to create anonymous functions. Function expressions in JavaScript are not hoisted, unlike function declarations. You can't use function expressions before you create them: - Naming functions is useful if they need to reference themselves (e.g. for recursive calls). Indeed, if you are passing a literal function expression as an argument directly to another function, that function expression cannot directly reference itself in ES5 strict mode unless it is named. For example, consider this code: let result = setTimeout(functi

Understanding Collections

Why do we need collections      Usually to store multiple values in a variable we use Array. But arrays have some disadvantage as below They are fixed in size. It means we cannot increase the size of the array dynamically.  We cannot insert/delete values to the middle of the array.  If at all if we want to increase the size of the array then we have to explicitly create new array and then copy all the values from old array to the newly created array.  There is one more way to increase the size of the array. We can use Array.Resize( )method. This method does same thing which I said in the above point. Only thing is it destroy the old array automatically.  Hence to overcome all these we should use collections.  We have two types of collections Non-Generic collections Generic Collections Non generic Collections Stack Queues ArrayList- Mostly commonly used Hastable SortedList LinkedList Please note : above are classes and they are defined in the namespace called "COLLECTIONS" Arr