Articles on Trending Technologies

Technical articles with clear explanations and examples

How to handle errors while working with Navigation in ReactNative?

Shilpa S
Shilpa S
Updated on 15-Mar-2026 1K+ Views

Problem: How to handle the error "A navigator can only contain 'Screen' components as its direct children" while working with Navigation in ReactNative? Solution While working on your app you may come across issues like stated above. Here we'll understand why such error comes up and what can be done to avoid it. Here is the code that gives us the error: Example with Error App.js import * as React from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { Button, View, Alert, Text } from 'react-native'; ...

Read More

Add number strings without using conversion library methods in JavaScript

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 318 Views

We are required to write a JavaScript program that adds two numbers represented as strings, without using any conversion library or built-in methods. For example, If the input number strings are '11' and '23', the output should be '34'. In JavaScript, a number is considered a string-represented number when the number is enclosed in single quotes ('number') or double quotes ("number"). For example: '123' or "456". If you use the typeof operator on such values, it will return the type as 'string'. Here are a few input and output scenarios that provide a better understanding of the given ...

Read More

Maximum Product of Two Numbers in a List of Integers in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 335 Views

We are required to write a JavaScript function that takes in an array of integers as the first and only argument. The function should find the maximum product that can be achieved by multiplying any two elements of the array. The condition is that we have to do this in linear time O(n) and constant space O(1). For example, if the input array is: const arr = [3, 9, 2, 1, 0]; Then the output should be: const output = 27; because it's the greatest product and can be achieved ...

Read More

Returning the value of nth power of iota(i) using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 180 Views

In mathematics, the imaginary unit i is defined as the square root of -1. When calculating powers of i, the results follow a cyclic pattern that repeats every 4 powers. Mathematical Background The imaginary unit i has the following properties: i = √(-1) i² = -1 i³ = -i i⁴ = 1 Since i⁴ = 1, the pattern repeats every 4 powers. This means we can use the modulo operator to determine the result for any power of i. Power Pattern Power (n % 4) Result (iⁿ) 0 ...

Read More

crypto.getCiphers() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 337 Views

The crypto.getCiphers() method returns an array containing names of all the supported cipher algorithms in Node.js. This method is useful for discovering what encryption algorithms are available on your system. Syntax crypto.getCiphers() Parameters This method takes no parameters as it simply returns a list of all available cipher algorithms. Return Value Returns an array of strings, where each string is the name of a supported cipher algorithm. Basic Example Here's how to get all available cipher algorithms: // Importing the crypto module const crypto = require('crypto'); // ...

Read More

How to handle the error "Text strings must be rendered within a component" in ReactNative?

Shilpa S
Shilpa S
Updated on 15-Mar-2026 7K+ Views

The "Text strings must be rendered within a component" error in React Native occurs when text or strings are placed outside of proper text components. This error typically happens due to formatting issues, improper indentation, or invisible characters in your JSX code. Common Causes This error commonly occurs due to: Bad indentation - Improper spacing that confuses the JSX parser Trailing spaces - Invisible whitespace characters at the end of lines Copy-paste issues - Hidden characters from external sources Text outside ...

Read More

How to Generate a PDF from an HTML Webpage?

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 19K+ Views

Converting HTML content to PDF is a common requirement for web applications. This allows users to save content for offline reading, generate reports, or create downloadable documents. There are two primary approaches to generate PDFs from HTML webpages: Using the browser's native print functionality Using JavaScript libraries like jsPDF Method 1: Using Browser Print Functionality This method leverages the browser's built-in print feature to create a PDF. It opens a new window with the content and triggers the print dialog. Steps: Open a ...

Read More

Why is JavaScript considered a loosely-typed language

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 3K+ Views

JavaScript is considered a loosely typed language because you don't need to declare variable types explicitly. JavaScript automatically determines the data type based on the value assigned to the variable. This flexibility sets it apart from strongly typed languages like Java or C++. What Makes JavaScript Loosely Typed? In JavaScript, you can assign any type of value to a variable without declaring its type: JavaScript Loose Typing Example let variable = 42; ...

Read More

How to open link in a new window using JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 9K+ Views

If you want users to click on links and open those links in a new window because you want your user to stay on your site while they view the linked content, then you need to use this solution. By using JavaScript you can easily configure all of your links so that they open in a new window when clicked. Approach to Open Link in a New Window Using window.open() Method Using target="_blank" with onclick Using window.open() Method JavaScript window.open() method allows you to open a new ...

Read More

Converting numbers to base-7 representation in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 803 Views

In JavaScript, converting a number to base-7 representation involves repeatedly dividing by 7, similar to binary conversion but using 7 instead of 2. Base-7 uses digits 0-6. Understanding Base-7 Conversion To convert a decimal number to base-7, we divide the number by 7 repeatedly and collect the remainders. The remainders, read in reverse order, form the base-7 representation. Example Here's how to implement base-7 conversion in JavaScript: const base7 = (num = 0) => { let sign = num < 0 ? '-' : ''; num ...

Read More
Showing 15901–15910 of 61,297 articles
Advertisements