
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript
4K+ Views
The comprehension of numerical patterns in JavaScript is indispensable for web developers who aspire to elevate the effectiveness and proficiency of their code. This notion encompasses the creation of a sequence of numbers that abides by a designated principle or arrangement, rendering valuable perception into the fundamental mathematical concepts that regulate the function of complicated algorithms. The capacity to generate numerical patterns is an elemental aptitude for web developers who strive to refine their code and enrich the user experience of their web-based applications. In this write-up, we will scrutinize the complexities of generating numerical patterns in JavaScript, scrutinizing the ... Read More

350 Views
Suppose we have an array of integers, (positive, negative and zero) like this −const arr = [23, -1, 0, 11, 18];We are required to write a JavaScript function that takes in one such array as the first and the only argument. The function should then find the fractional ratio for all three different groups, namely positive, negative and zero.For example −For the above array, its length is 5, the output for this array should be −const output = [.2, .2, .6];The output array will always contain 3 numbers, representing the fractional ratio of negative, zero and positive integers respectively. One ... Read More

386 Views
Suppose we have two array of numbers of the same length like this −const arr1 = [23, 67, 12, 87, 33, 56, 89, 34, 25]; const arr2 = [12, 60, 45, 54, 67, 84, 36, 73, 44];We are required to write a JavaScript function that takes in two such arrays as the first and the second argument. The function should then compare the corresponding values of both the arrays, and the function should return −-1, if the count of corresponding numbers greater in the first array than the second array are more than corresponding numbers greater in the second array1, ... Read More

10K+ Views
Converting 12 hour format time to 24 hour format in JavaScript can be easily achieved using various approaches which we will be discussing in this article. For conversion from 12 hour to 24 hour format we check for the modifier(AM or PM). Depending on the modifier we convert the time formats. In this article, we have specified a time at the beginning in 12 hour format. Our task is to convert 12 hour format time to 24 hour format in JavaScript. Approaches to Convert 12-hours format to 24-hours Here is a list of approaches to convert 12 hour format ... Read More

284 Views
Suppose, we have an array of numbers like this −const arr = [1, 6, 3, 1, 3, 1, 6, 3];We are required to write a JavaScript function that takes in one such array as the first and the only argument. Then the function should look for all such numbers in the array that appear for an odd number of times (excluding only once).For example, In the above array, the numbers 1 and 3 both appear for 3 times (odd), so our function should remove the third occurrence of both these numbers.And the output array should look like −const output = ... Read More

14K+ Views
Suppose, we have the following JSON object that may contain nesting upto any level −const obj = { "one": 1, "two": { "three": 3 }, "four": { "five": 5, "six": { "seven": 7 }, "eight": 8 }, "nine": 9 };We are required to write a JavaScript function that takes in one such nested JSON object and returns a new object that contains no nesting and maps the corresponding values to the keys using the dot ... Read More

310 Views
Suppose following is the problem:We have a sequence of numbers starting from 1 and upto any arbitrary number, let's call it num. We have to pick two such numbers from the sequence (let's call them m and n), such that:sum(1 to num) - (m + n) = m * nAnd finally, we should return an array of groups of all such numbers.For example −If the input is −const num = 10;Then the output should be −const output = [ [7, 6] ];because sum(1 to 10) = 55and, 55 - (6 + 7) = 6 * 7 = 42ExampleThe code ... Read More

4K+ Views
We are required to set cookies with AJAX requests or in such a way that any AJAX request sends those cookies to the server.One thing to note here is that every AJAX request made to any remote server automatically sends all our cookies to that very server without us having to do anything. Therefore, with this thing clear, we just have to set a specific key to our document object using JavaScript and whenever we make a network call, that cookie will automatically be sent to the server which we are making the call to.The code for setting the cookie ... Read More

741 Views
Problem:When we try to make network request to a remote server whose origin is different to our current url (from which we are making the request), we most likely get a CORS error due to different origin problem in the web, whereas while using a tool like Postman, we can successfully avoid this CORS error.We are required to explain the difference in behaviour of response when requested through web and when requested through an extension like postman.Explanation:When we make a network request to a different domain than our page is on using a web browser, it blocks that request and ... Read More
11K+ Views
The ability to preview an image before it is uploaded holds significant value in the realm of web development, allowing users to have a glimpse of their selected image and make necessary adjustments prior to submission. Employing JavaScript, a versatile programming language, developers can harness the power of client-side processing to implement this functionality seamlessly. In this article, we will embark on an exploration of how to preview an image before it is uploaded using JavaScript, unveiling a step-by-step approach and leveraging seldom-utilized techniques to accomplish this task. By delving into the intricate details of this process, developers will gain ... Read More