Skip to main content

Posts

JavaScript Interview Questions

JavaScript Interview Questions: 1. Input: array=[3,4,5,6,7,8,9] Output: 4,5,6,7,8,9,10 2. var obj={name:"test"} Replace the the text of div with the value of  name key from an above JavaScript object. <div id="test">This is a text</div> 3. for(var i=0; i<3; i++){     setTimeout(() =>console.log(i) },2000); What it will print in console of the browser?

Keyboard shortcuts of Visual Studio Code for Windows

 Keyboard Shortcuts of Visual Studio Code for Windows: General Ctrl+Shift+P, F1    Show Command Palette Ctrl+P   Quick Open, Go to File… Ctrl+Shift+N   New window/instance Ctrl+Shift+W    Close window/instance Ctrl+,    User Settings Ctrl+K Ctrl+S    Keyboard Shortcuts Basic editing Ctrl+X    Cut line (empty selection) Ctrl+C   Copy line (empty selection) Alt+ ↑ / ↓   Move line up/down Shift+Alt + ↓ / ↑    Copy line up/donwn Ctrl+Shift+K   Delete line Ctrl+Enter   Insert line below Ctrl+Home   Go to beginning of file Ctrl+shift+Enter   Insert line above Ctrl+shift+\   Jump to matching bracket Ctrl+] / [   Indent/outdent line Home/End   Go to beginning/end of line Ctrl+End   G...

Check the password of an Wi-Fi connected to the PC or Laptop.

 Check the password of an Wi-Fi already connected to a PC or Laptop: To check password of Wi-Fi already connected to the PC or laptop, a user/you need to follow the below steps:- Step1: Firstly check the Wi-Fi symbol/net connectivity signal  on the taskbar and RightClick on it.                          Step2: Second click on the Open Network and Internet Settings.                                               Step 3: Next click on Network and sharing center.                         Step 4: Now click on the WiFi (connected wifi name).                          Step5 : Tap or select Security and click on the Show characte...

Find the index of a matching element from an array.

 Get the index of a matching element from an array: Method 1: using without any method (Original code)- let cars = ["BMW", "Volvo", "Mini"]; let element = 'Volvo'; for( let i= 0; i <= cars.length; i++){     if(cars[i] === element){         console.log(i);         return i;     } else {         console.log(-1);         return -1;     } } Output:  1 Method 2: using indexOf  method - let cars = ["BMW", "Volvo", "Mini"]; let element = 'Volvo';     if(cars.indexOf(element) == -1){         console.log("-1");     } else {          console.log(cars.indexOf(element));     } Output:  1 Method 3: using indexOf & includes  method - let cars = ["BMW", "Volvo", "Mini"]; let element = 'Volvo';     if(!cars.includes(element)){         console.log("-1");  ...

5 JavaScript Developer Interview questions asked by an game company

5 JavaScript Developer Interview questions asked by an game company: JS Developer Questions from a gaming company Questions:01. You need to show the length of each string Input: var x = "Hello I Am Great Developer"; Output: 5,1,2,5,9 Questions:02. You need to Find the next character of input string as output string Input: var x = "Hello World"; Output: "ifmmp xpsme" Questions:03. What will be the result of the below 2+"2"-"2" Questions:04. Check that the below number exists in finacci series or not. input:1000 Output:true or false Questions:05. Angram or Filtering words from a dictionary. Input: HAM,MAH,RAJU,AJUR,UJAR,YADAV,DAAVY; Output: HAM, MAH, (Anagram) AJUR, RAJU,UJAR YADAV,DAAVY Is this helpful to you?

Write a script/program to check a string is palindrome or not.

Script/program to check a string is palindrome or not: function testFun(txt){     var newTxt = txt.split("");     var myOP = "";       for(let i = newTxt.length-1; i>=0; i--){       console.log(newTxt[i]);         myOP += newTxt[i];     } // console.log(myOP);     if(txt === myOP){         console.log(txt + " is Palindrome");     }else{         console.log(txt + " is not Palindrome");     } } var str= "RAJU"; testFun(str); //First call of test function var str2= "MADAM"; testFun(str2);  //Second call of test function Output: Raju is not Palindrome. //First call of test function MADAM is Palindrome.//Second call of test function

Object in JavaScript

 Object in JavaScript: var company = {     "name":"EPM Solutions Ind. Pvt Ltd.",     "compannyID":2,     "city":"Bangalore", }; var company = {     "name":"EPM Solutions Ind. Pvt Ltd.",     "compannyID":2,     "city":"Bangalore",     "street":"Kadubisnahalli",     "state":"Karnataka",     "pincode":"560103",     "address":function(){         return this.street+", "+this.city+", "+this.state+", - "+this.pincode;     },     'knownTech':['JS','HTML','jQuery','CSS'] };

Save Conflict. Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.

Save Conflict. Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes. Reason:  Generally the above issue arises when a item/record of a SP list is used my two person or process (Workflows/Ms Flows) at same time. Solution: So Try to avoid update on same item by two or more user at same time. Try to use synchronous flow of process.

Redirect a webpage to another webpage using JavaScript

 Redirect a webpage to another webpage using JavaScript We may able to use the below global object properties to redirect a page to another page on same Tab of a browser. window.location = "http://etechmate.blogspot.com"; OR window.location.href = "http://etechmate.blogspot.com"; OR  window.location.replace("http://etechmate.blogspot.com"); Output: If we use any of above snippet code then it will open a webpage like etechmate.blogspot.com in same tab of the browser

Print elements of an array in JavaScript

 Print elements of an array in JavaScript: //Example 1 var num = 5; var members = ['Parameswar','Minta','Raju','Indu','Chandan'];  function printArrayElements(arr,n){     console.log('Elements of Array are:');     for(var i=0; i<n; i++){         console.log(arr[i]);     } } printArrayElements(members,num); //Example 2 var n = 5; var numbers = [85,86,87,88,89];  function printElementsOfArray(arr,n){     console.log('Elements of Array are:');     arr.forEach(function(el,k){         console.log(el);     });  } printElementsOfArray(numbers,n); Output of Example 1:  Elements of Array are:  Parameswar  Minta  Raju  Indu  Chandan Output of Example 2:   Elements of Array are:  85  86  87  88  89 Is this blog helpful? Test

Print Elements of Array

  Print Elements of Array: Given an array  Arr  of size  N , print all its elements. N = 7; var fruits = ['Mango', 'Apple','Pineapple','Orange','Papaya','Grapes','Banana']; Output : Mango                  Apple                   Pineapple                Orange                Papaya                Grapes                Banana N = 5; var numbers= [1,2,3,4,5]; Output : 1               2                  3               4                5

How to get all site users of SharePoint using REST API?

Get all users of SharePoint site using REST API: These users and its data are required to update people field of a SharePoint list. By using below snippet code we can able to get details of a user of SharePoint site.     var webURL = _spPageContextInfo.webAbsoluteUrl+"/_api/Web/SiteUsers";         $.ajax({           url: customFieldURL,           method: "GET",           headers: {             "Accept": "application/json; odata=verbose"           },           success: function (data) {            console.log(data);             data.d.results.forEach(function(cm){                     console.log(cm.Title+" - "+cm.Email+" - "+cm.Id);             });      ...

How to get data of more than one SharePoint list using REST API?

 Get data of more than one SharePoint list using REST API: By using below snippet code we can able to get data of two SharePoint list at time.  var getDataModule = (function () {       var baseRequest = {           url: "",           type: ""       };       var getApp = {       };       var getApp = {           receivedRequest: receivedRequest,       };       function receivedRequest(endpoint, _async) {           //var dfd = $.Deferred();           var request = baseRequest;           request.type = "GET";           request.async = false;           request.url = endpoint;           request.headers = {               'AC...

How to trigger a MS Flow Using Jquery/JavaScript?

Trigger a  MS Flow Using jQueryuery/JavaScript: To trigger an MS Flow first we need to create an workflow. Next we need to obtain its URL for triggering it. In below example, we are starting a workflow which is taking email address, email subject and email body as parameter and sending mail to email of related user. //This function triggers the microsoft flow  function beginMSFlow() {          var httpPostUrl = "obtain URL from MS flow";          var postData = {              emailadress:'raju@testdev.com', // Object keys must be similar as you used in the MS flow             emailSubject:'Testing Raju',              emailBody:'Hello User\n Welcome, You just trigger a MS Flow'             };           $.ajax({           url: httpPostUrl,    ...

Write a JavaScript Program to print given number of radio buttons

  JavaScript program to print given number of radio buttons: <html lang="en"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Write a code to print numbers of radio buttons in JavaScript</title> </head> <body>     <span id="output"></span> <br><br>     <label for="num1"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num1" value="5">5</label>     <label for="num2"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num2" value="10">10</label>     <label for="num3"><input type="radio" name="numbers" onclick="radioBtnClick(this)" id="num3" value=...

How create and object and add five key values pair to it in JavaScript?

 Create and object and add five key values pair to it in JavaScript: Developer can use below snippet create and add 5 key-value pairs in it. var obj = {};// an empty object has created for(var i = 1; i<=5; i++){ // A loop has added to add key- values in above object     obj['number'+i] = i; //here we are using Squire brackets [] to add keys & after assignment symbol values. here values are numbers } console.log(obj); Output :