Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Front End Scripts Articles
Found 465 articles
JavaScript Program to Find Minimum Insertions to Form a Palindrome
We are given a string and we have to find the minimum number of characters that we need to insert at any position to make the string a palindrome. A palindrome is a string that reads the same forwards and backwards. This problem can be solved using dynamic programming - we'll explore three approaches: recursive, memoization, and tabulation. Understanding the Problem For example, to make "abc" a palindrome, we need to insert 2 characters to get "abcba" or "cbabc". The key insight is that if characters at both ends match, we can focus on the substring between them. ...
Read MoreSorting a JSON object in JavaScript
In JavaScript, objects themselves cannot be sorted since their properties don't have a guaranteed order. However, we can extract the values from a JSON object and sort them into an array. Suppose we have an object like this: const obj = { key1: 56, key2: 67, key3: 23, key4: 11, key5: 88 }; We need to write a JavaScript function that takes this object and returns a sorted array of its values: const arr = [11, 23, 56, ...
Read MoreES6 Default Parameters in nested objects – JavaScript
ES6 allows you to set default parameters for nested objects using destructuring assignment. This feature helps handle cases where nested properties might be undefined or missing. Syntax function myFunction({ outerKey: { innerProperty = defaultValue, anotherProperty = anotherDefault } = {} } = {}) { // Function body } Example Here's how to implement default parameters in nested objects: function ...
Read MoreHow to design a modern Website?
Modern websites are responsive and the design works fine on multiple devices such as Desktop, Tablet, and Mobile. Also, websites these days do not follow the old font styles, many of them use Google fonts since it's easy to find a font-face matching your website's content and Google provides a lot of free fonts to choose from. Modern websites display beautifully formatted content on multiple devices such phones, tablets, and desktops. Also, nowadays Retina-ready logos help in keeping your logo amazing, no matter the resolution. Follow the below given steps and learn how to design a modern website: ...
Read MoreHow to set the widths of the image border with JavaScript?
In this tutorial, we shall learn to set the widths of the image border with JavaScript. To set the widths of the image border, use the borderImageWidth property in JavaScript. When we need an image as a border of our webpage content, we have to see how to set the width of the image border. Using the Style borderImageWidth Property With the Style borderImageWidth property, we can set or return the widths of the image border of an element. The border image will range beyond the padding when the border image width is greater than the ...
Read MoreHow to set the size of the background image with JavaScript?
In this tutorial, we will look at the method to set the size of a background image with JavaScript. Background effects on a webpage enhance its look. We can set a background color or a background image to enhance the feel of the webpage. We can also change the background properties, like its size or color. To enhance the feel, the image must fit in the right position with the right size. Generally, we do this by using CSS, but JavaScript DOM also provides properties to do so. So, let us look at how to set the ...
Read MoreHow to set whether the image-border should be repeated, rounded or stretched with JavaScript?
This tutorial will teach us to set whether the border image should be repeated, rounded, or stretched with JavaScript. Use the borderImageRepeat property to set whether the image-border is to be repeated, rounded, or stretched. Borders are used to decorate or focus an element. You can define its width, color, and type of border. Various styles can be applied to the borders. But, these borders are without any special effects or any other designs. Using the border-image property, we can set an image as a border of an element. It does not look like a line. It will ...
Read MoreClient-side image processing with HTML
Client-side image processing allows you to manipulate images directly in the browser using HTML, CSS, and JavaScript without server uploads. This approach provides instant feedback and reduces server load. HTML Structure for Image Processing Start with a basic HTML structure that includes file input and canvas elements: Client-side Image Processing Image Processing Demo ...
Read MoreSplitting and uploading extremely large files to Amazon S3
When dealing with extremely large files (10+ GB), uploading directly to Amazon S3 can be challenging due to network timeouts and bandwidth limitations. Amazon S3's multipart upload feature provides a robust solution by splitting large files into smaller chunks that can be uploaded independently and in parallel. How Multipart Upload Works The process involves three main steps: Initiate: Start a multipart upload session with S3 Upload Parts: Split the file into chunks and upload each part independently Complete: Combine all parts into the final object ...
Read MoreHow to set an image as the list-item marker with JavaScript?
To set an image as the marker in list items, use the listStyleImage property in JavaScript. This property allows you to replace default list markers (bullets or numbers) with custom images. Syntax element.style.listStyleImage = "url('image-path')"; Example The following example demonstrates how to set a custom image as the list-item marker: First Item Second Item Third Item ...
Read More