Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

javascript

  1. L

    Animating when content loads in Selte

    I have a website which lists hiking tours as cards in Svelte. I use {#each} to generate the cards: {#each tours as tour} <Card {tour} /> {/each} The contents of the cards are grabbed from a separate file in the directory, I'm not using APIs. I wanted to have animation for them when the...
  2. X

    javascript how to express many-digit exponentials to 2 decimal places

    I have a javascript program which spits out large arrays of numbers of the form '3.173538947635389377E+98', in the console, and have tried without luck to reduce them to something like '3.17E+98' for ease of comparison. I Stringified the number, calculated the period and E locations, cut and...
  3. S

    Extract price from string array and sort by price

    I need help determining the best way to extract the price value out of the strings in the array received from the API, and then reorder the array based on the lowest price values. These are some of the data that I received from the API. let luxcar_data = ["Ferrari70", "Bugatti45", "McLaren17"...
  4. C

    how to maintain bluetooth device connection throughout the react native app

    I'm new to react native, ive created an app using react native, im working on bluetooth device that connects with app and gives me data.. everything is working fine. but i want the device to stay connected through out the app. but not at the single page.. since i need the device to give me data...
  5. S

    How to match the exact string and replace all with other string using regular expression?

    Recently I came across one issue where I need to change the double curly braces with triple curly braces , The below example could clarify the need further, let mystring = '{{Hello Tom}} , {{How are you doing today}}' I need to change the above string and replace "{{" and "}}" with "{{{" and...
  6. H

    Reactjs - MUI HTML Tooltip is not working with dynamic HTML content

    I am using customized HTML MUI Tooltip. It is working with static content. I want to make it dynamic. It is not working with the dynamic html content. I am trying the following way. const ADJUSTMENT_HELP_TEXT = styled(()=>( <Typography component="div"> <em>Adjustments can be added...
  7. M

    Group an array of objects based on multi keys in Javascript?

    I would like to share with you an existence problem I have array as follows const data = [ { "countries": ["France", "USA", "Canada"], "city": "Paris", "stadium": "Parce de france" }, { "countries": ["France", "Itlay", "Spain"], "city": "Roma", "arena": "La cigal" }, {...
  8. F

    How to set position of vertical html menu element on page load

    I am developing a website with 30 pages. Each page has two columns: a vertical scrolling menu in the left column and the page content in the right column. Each page has the same html code for the menu: <div class="nav-scroll-menu"> <a href="page1.html" class="nav-menu-item">...
  9. R

    getting an error while trying to pick a directory using expo document picker in react-native

    hay guys, i am making a react native app with expo and i am using "expo document picker" module to access the folder in the device by clicking on the button in my app , i am getting this error in my terminal -- LOG [Error: Encountered an exception while calling native method: Exception...
  10. D

    Laravel Vue 3 Project when npm run dev: Error: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],

    I have a laravel 9 vue 3 project. After php artisan serve when I run npm run dev, I receive following error: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code...
  11. J

    JavaScript add space to a string after 2 characters but ignore newline character

    I have to insert a space after every two characters in a string but by completely ignoring the newline character. I am able to do the spacing part but the problem comes with the newline as that is also counted as a character and when rendering the string it adds space at wrong positions. let...
  12. A

    React redirect to URL in all lowercase when there is an uppercase letter

    I have a custom route implementation:- import React from 'react'; import { Route } from 'react-router-dom'; import AuthUrl from '../auth/authUrl'; export default function PrivateRoute(props) { const { component: Comp, exact, path} = props ; return <Route exact={exact}...
  13. V

    How to set default value for a pair of buttons based on API response? VueJS

    I have a pair of buttons that has to be toggled based on the response I get from API.The button has to set only once when the page loads. The code I am using for this <div class="small-7 column btn-switch"> <span class="switch-statement">"Is it mandatory"</span> <button...
  14. A

    How do I solve this code when user select the second dropdown(select_2) box it will go to a hyperlink or new website

    I have two dropdowns. If an option is selected in dropdown 1 then the second option will appear in dropdown 2. When the option in dropdown 2 it is selected, I wanted to redirect it to open another link or website Here is a codepen that I started, but I am not sure where to go from here: <div...
  15. S

    array different data inside a single array

    how can I get all this array in one array without getting it one after the other like this in the code below? i mean saving the whole data inside one variable without giving a specific index of the array here's the code const favoriteProductone = data?.getAllLikeProduct[0] const...
  16. F

    I am trying to make routes but somehow express routers are not working

    I think that I am not making any mistake in the code. I am not getting why this is not working when I am trying to access it on localhost server.js const express = require('express') const app = express(); const controller = require('./mailtemplate/mailtemplate.controller') var http =...
  17. A

    map through object of objects to return object

    I tried looking into other examples but I am not getting it. I am trying to loop through obj of objects and return an object with key value pair. const res = {0 : {id: "id1", name: "name1" , rollno: "1"}, 1 : {id: "id2", name: "name2", rollno: "2"}} const section = {"id1" : "section A", "id3"...
  18. V

    Selected text remove element already wrapped in a span

    I have a scenario/dilemma, I am a little stuck trying to figure out. Below will be my best of a visual representation. 1. I select This is dummy text to select 2. I bold and it gets wrapped with a span This is dummy text to select <h2 This is dummy <span style="font-weight: 700;">text to...
  19. T

    How to highlight hex code in text while typing

    I want to highlight the hex code in the text while typing it. I have a code that looks for a hex code among the already written text and highlights it. $(".hwt-highlights").each(function(){ var hex = /#([a-zA-Z0-9]+)/g; var spanhex = '<mark style="background-color: #$1">#$1</mark>'...
  20. A

    Elements in the date array update automatically

    I'm trying to find week days between first date and second date (exclusive first and second). In the array that contains the weekday dates, the values get increment after line 1 in executed, which is unexpected. private getListOfWeekDaysBetweenTwoDates( startDate: Date, endDate: Date...
Top