Switch Language of the Page Using JavaScript

Shubham Vora
Updated on 05-Apr-2023 15:50:29

9K+ Views

Whenever you develop a website or application for a worldwide business, you must also focus on which language your audience can understand. For example, English is an international language, but in some parts of the world, people don’t understand English as they speak German, Spanish etc. However, if you have observed, then some websites provide the option to change the website's language. You just need to click on the button, which changes the whole website's language. Have you ever thought about how it is possible? Here, we will learn to switch the language of the web page using JavaScript. Syntax ... Read More

Style Google Custom Search Manually Using CSS

Shubham Vora
Updated on 05-Apr-2023 15:47:14

897 Views

Have you ever tried to build a custom search engine? If yes, you are aware of how much effort it takes. The first thing is that we need to create a search algorithm that should show the best matching results when any user searches. It can take a lot of time. Rather than wasting time on creating our search engine, what if we use the Google custom search engine? Yes, you heard right! Google allows us to integrate the search engine on our website, and Google handles everything when any user searches for something on our website. Integrating the Google ... Read More

Store JavaScript Functions in a Queue and Execute in Order

Shubham Vora
Updated on 05-Apr-2023 15:45:32

727 Views

Sometimes, developers may require to store the function in the queue and execute it in the order it is stored in the queue. In JavaScript, we can create a queue using the array. We can use the push() method of the array to enqueue the function in the queue and the shift() method to deque the function from the queue. Below, we will see examples of storing JavaScript functions in the queue and executing them in the queue order. Syntax Users can follow the syntax below to store JavaScript functions in a queue and execute in that order. while (queue.length ... Read More

Store Data to DOM

Shubham Vora
Updated on 05-Apr-2023 15:42:53

2K+ Views

Storing data in the DOM means storing data in plain text format. For example, we store data in the state variable while using React or any other reactive framework. When the user updates the data in the input field, it stores updated data in the state variable. So, we store data in the state variable before we submit the form. At the time of submitting the form, we use the values of the state variables. In vanilla JavaScript, we can do the same, like storing data in plain text format, and whenever we require to submit the form, we can ... Read More

Show/Hide DIV Element Using Bootstrap and jQuery

Shubham Vora
Updated on 05-Apr-2023 15:40:04

3K+ Views

Sometimes, we may require to show and hide div based on the selected values. For example, you want to show the registration or login forms based on the radio button's selected value. Below, we will learn to show/hide the div elements based on the selected value using JQuery. Show/hide the div Element Depending on the Selected Value From the Select Menu In JQuery, we can get the selected option’s value from the ‘select’ menu. After that, we can access the div element according to the selected option value and show them. Syntax Users can follow the syntax below to show/div ... Read More

Show Custom Menu on Text Selection

Shubham Vora
Updated on 05-Apr-2023 15:37:29

841 Views

In some text editors, when you select the text, it shows the menu to edit texts and provides functionalities like justifying text, aligning text, increasing the text size, changing colour, etc. Microsoft word is the best example of it. In Microsoft word, when you select any text, it shows the custom horizontal menu to perform some actions on the text. This tutorial will use JavaScript to create a custom menu on the text selection. Syntax Users can follow the syntax below to show some custom menu on text selection. let coOrdinates = document.querySelector(".content").getBoundingClientRect(); let posX = clientX - Math.round(coOrdinates.left) + ... Read More

Dijkstra Algorithm to Find Shortest Path Between Two Nodes in Go

Akhil Sharma
Updated on 05-Apr-2023 15:33:29

2K+ Views

In this Golang article, we will explore how to implement Dijkstra's Algorithm to find the shortest path between two nodes in a graph using an Adjacency Matrix as well as using an Adjacency List. Dijkstra's Algorithm is used to solve the single-source shortest path problem in a graph with non-negative edge weights. Algorithm Step 1 − First, we need to import the fmt and math packages. Then create a dist array of length n (the number of nodes in the graph) and initialize it with math.MaxInt32. This array will store the shortest distance from the starting node to every ... Read More

Golang Program to Implement Merge Sort

Akhil Sharma
Updated on 05-Apr-2023 15:33:06

1K+ Views

In this Golang article, we will learn how to implement Merge Sort in Golang using three different methods recursions, iteration and goroutines. Merge sort is one of the most efficient sorting Algorithms that uses the divide and conquer approach to sort a list of elements. Syntax func copy(dst, str[] type) int The copy function in go language is used to copy the values of one source array to the destination array and returns the number of elements copied as the result. It takes the two arrays as an argument. func len(v Type) int The len() function is used ... Read More

Find Shortest Path Between All Pairs of Nodes in a Graph Using Dijkstra Algorithm

Akhil Sharma
Updated on 05-Apr-2023 15:31:50

614 Views

In this golang program article, we are going to learn how to use a struct Edge to represent a weighted edge in the graph, and the dijkstra function takes the number of nodes n and a slice of Edge objects as input. It returns a two-dimensional slice representing the distance matrix between all pairs of nodes in the graph In this Golang article, we will explore how to implement Dijkstra's Algorithm in to find the shortest path between all pairs of nodes in a graph. Algorithm Step 1 − First, we need to import the fmt and math packages. ... Read More

Find Minimum Number of Resources to Complete All Tasks Simultaneously in Go

Akhil Sharma
Updated on 05-Apr-2023 15:30:49

184 Views

In this Golang article, w will understand how to use interval scheduling Algorithm find the minimum number of resources needed to complete all the tasks simultaneously. Interval scheduling Algorithm is a type of Algorithm used to solve scheduling problems where a set of tasks with start and end times must be scheduled on a limited resource. Algorithm Step 1 − First, we need to import the fmt and Sort packages. Then initialize the required structs along with the functions. Step 2 − The task struct is used to track the start and end time of the task whereas ... Read More

Advertisements