JavaScript answers

  • 3answers
    How to replace numbers with words via map?
    I have a string of numbers - '80 75 60 90 '. I need to replace them with words with a certain condition: if the number is in the range of 50-100, then replace it with the word "First", for a number from 30 to 50 by "Second", for a number from 10 to 30 by "Third". It also needs to be ...
    JavaScript Anonymous, Dec 17, 2020

  • 2answers
    How to do this?
    I want to implement similar functionality. We managed to change the values, but if, let's say, I chose the Russian language, and then decided to select English again, then it is no longer there, it is gone. Please tell me how you can make it so that when you click from the list, let's ...
    JavaScript Anonymous, May 24, 2019

  • 1answers
    How to make the background color of the text depending on the photo?
    I am trying to make the logic of selecting the background color depending on the picture using the example - https://zen.yandex.ru/ . I don’t find an adequate solution. Tell me, pliz, who faced similar solutions or libs?
    JavaScript Asher Hinton, Mar 20, 2020

  • 0answers
    How to create a multilevel list?
    I have 2 JSON files like this: https://yadi.sk/d/k9GCcUo72cfRvg?w=1 How can I do it correctly so that it ends up like this: My current solution looks, in my opinion, not very universal, since everything will break with the growth of nesting: class Sections extends React.Component { ...
    JavaScript Anonymous, Apr 8, 2019

  • 0answers
    How to set up sending orders to mail via simpleCart.js?
    Hello everyone. I'm using the https://github.com/wojodesign/simplecart-js library for a small online store But I can't figure out how to set up sending orders to the mail. After clicking on "Checkout" there is a redirect to PayPal I didn't find anything on the net. Please tell ...
    JavaScript Amelia Mullins, Mar 15, 2020

  • 1answers
    How to make the files with the extension code for Google Chrome editable from the browser?
    Hello! I saw an interesting solution in someone else's extension for Google Chrome: 1) Click on the extension icon in the upper right corner. 2) Click on the gear. 3) A list of files controlled by the extension opens. 4) Click on any of these files and get a window in the browser through ...
    JavaScript Anonymous, Dec 23, 2019

  • 2answers
    What is the best way to make a button that the modal will click on?
    https://imgur.com/a/eOxKXz4 As for me, the button would be stupid in this case using the tag & lt; button & gt; or & lt; a & gt; . It won't be easier to do everything in one div and give cursor: pointer for this div; , and the modal is already c js by pressing? And how, in my case, is it ...
    JavaScript Anonymous, Jun 22, 2019

  • 0answers
    How to correctly type a method decorator?
    Good day. Tell me how to type the Compute method class SomeClass { foo: string; bar: [email protected](['foo', 'bar']) fooBar({ foo, bar, }): void {}} export function Compute< T extends { [key: string]: any; }, K extends keyof T = keyof T>( reactiveInputs: K[], ...
    JavaScript Alice Carney, Jun 11, 2019

  • 1answers
    How to isolate a widget from site styles?
    The situation is as follows - I am developing a widget for myself, which is connected using a short script and HTML code: <div id="myWidget"></div><script type="text/javascript"> (function (w,d,s,o,f,js,fjs) { w['MyWidget']=o;w[o] = w[o] || function () { (w[o].q = w[o].q || ...
    JavaScript Anonymous, Feb 12, 2020

  • 0answers
    How can I get the coordinates of the cursor on the map using Google API v3 and Vue?
    The problem is this. On the map component, I'm trying to capture the position of the cursor and send its coordinates (both on the map canvas and geographic) to the server. I coped with the coordinates on the canvas, that is, X-Y, but I just can't get to latLng. I catch it this way <maps ...
    JavaScript Anonymous, Feb 10, 2019

  • 1answers
    How to make a reference with data?
    Now a service has been written that has one method that returns data directories: @Injectable()export class InteragencyCooperationReferencies { public doctypes: ReplaySubject<any> = new ReplaySubject(1); public results: ReplaySubject<any> = new ReplaySubject(1); public ...
    JavaScript Anonymous, Mar 31, 2020

  • 1answers
    How do I make this animation?
    Good afternoon, you need to find a solution to one of the animation tasks https://obe.ru/anima/ (3, 4 or 5) There is a hint: Find cursor position inside svg let svg = document.getElementById ("svg"); let mouse = {x: 0, y: 0}; document.addEventListener ("mousemove", function (ev) {mouse.x ...
    JavaScript Victoria Bruce, Apr 4, 2019

  • 0answers
    Why don't the commands in the discord bot work?
    The code written as I can see without errors. But for some reason the bonus commands don't work. ! clear 100 or in the code the role issuance registered on the car simply does not want to give out the role, what could be the problem ??? I am writing in Js const Discord = ...
    JavaScript Lukas Vega, Aug 2, 2019

  • 1answers
    Why is the "cancel" button not working?
    Hello dear colleagues. I wanted to create a small website for my brother in two minutes, but I have problems with the clear button. Please check what I did wrong here: <!DOCTYPE html><html lang="ru"><head> <meta charset="UTF-8"> <title>Урок HTML ...
    JavaScript Anonymous, Oct 31, 2019

  • 0answers
    How do I update the DIV block without reloading the page?
    Hello everyone. There is a difficult task, finalizing the site on Tilda. Maybe someone worked) Link: https://direct.futuremarkt.com/usa Block: Action Plan. I made that when clicking on the numbers, the active block was hidden and the desired block was opened. This block contains a slider. ...
    JavaScript Anonymous, Aug 5, 2019

  • 1answers
    How do I rewrite this animation with - requestAnimationFrame?
    Made a little animation with setInterval How can you do it using requestAnimationFrame? Tried different options, but either gives an error or the animation doesn't start Code - sandbox
    JavaScript Cora Hutchinson, Mar 5, 2020

  • 3answers
    How to make an input form with a range slider like in the screenshot?
    How to create such an input form, maybe there is a ready-made library?
    JavaScript Chloe Li, Jul 3, 2020

  • 3answers
    Why doesn't style work for querySelector?
    Tried both querySelector, both querySelectorAll and getElementsByClassName. But you still can't change the style value. const buttons = document.getElementsByClassName('js-toggle-card'); for (const button of buttons) { button.addEventListener('click', () => { let ...
    JavaScript Quinn Aguirre, Sep 18, 2019

  • 3answers
    How do I compress an array of coordinates?
    The database contains polygons with a large number of coordinates. When a user enters a web application, these polygons are requested and drawn on the map. The weight of the answer is 7mb +, where almost all of this weight is coordinates. These polygons are often edited, so it's not an option ...
    JavaScript Sophia Calhoun, Jun 25, 2020

  • 0answers
    How to make a "show more" button with loading goods in shopscript cms (webasyst)?
    Help, how to make the "show more" button so that the products are loaded by clicking on it? For the whole day I have been sitting racking my brains, I cannot do it. I call the products themselves via list-thumbs.html
    JavaScript Gabriel Robles, Apr 13, 2020