How do I override the error function in dropzone.js?

The default error handler in dropzone.js is as follows and contains a default error implementation as below:

https://github.com/dropzone/dropzone/blob/main/src/options.js#L4

  // Called whenever an error occurs
  // Receives `file` and `message`
  error(file, message) {
    if (file.previewElement) {
      file.previewElement.classList.add("dz-error");
      if (typeof message !== "string" && message.error) {
        message = message.error;
      }
      for (let node of file.previewElement.querySelectorAll(
        "[data-dz-errormessage]"
      )) {
        node.textContent = message;
      }
    }
  },

Unfortunately the above code has the undesirable behaviour where if the server returns a non 2xx response, the HTML of that response is displayed as an error, which is incomprehensible to end users and makes them panic.

How do I replace the above callback in such a way that the above code is removed completely at runtime?

The following does not work, most specifically a breakpoint on the code above is still hit, and the HTML error text is still present:

  let dropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    url: "/upload/url", // Set the url
    previewsContainer: "#previews", // Define the container to display the previews
    uploadMultiple: true,
    autoProcessQueue: true
  });
  dropzone.on("error", (file, response, xhr) => {
    console.log("An error has occurred: " + file + response + xhr.status + xhr.statusText);
  });

500 IIS Internal server error near Fetch Api in django

I have deployed a django web application through Microsoft IIS. The deployment seems to be successful except for the error I am getting while submitting a form. I assume it’s occurring because of the URL string given in fetch API. Though I am not exactly sure what is causing the error. Seeking help for the same.

P.S- The yellow highlighted part in Console.log is the hostname on which I have deployed and now accessing the web page.

web.config

<configuration>
  <system.webServer>
    <handlers>
      <add name="Python FastCGI"
           path="*"
           verb="*"
           modules="FastCgiModule"
           scriptProcessor="C:Pythonpython.exe|C:PythonLibsite-packageswfastcgi.py"
           resourceType="Unspecified"
           requireAccess="Script" />
    </handlers>
  </system.webServer>

  <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
    <add key="PYTHONPATH" value="C:MyApp" />
    <add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />

    <!-- Optional settings -->
    <add key="WSGI_LOG" value="C:Logsmy_app.log" />
    <add key="WSGI_RESTART_FILE_REGEX" value=".*((.py)|(.config))$" />
    <add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />    
    <add key="WSGI_PTVSD_SECRET" value="__secret_code__" />
    <add key="WSGI_PTVSD_ADDRESS" value="ipaddress:port" />
  </appSettings>
</configuration>

Console.log

Console.log

urls.py

urls.py

Logs

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:14:28
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:14:28 10.9.20.237 GET / - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 - 200 0 0 978
2022-05-30 06:14:29 10.9.20.237 GET /static/AIG-Logo.png - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 200 0 0 32
2022-05-30 06:14:29 10.9.20.237 GET /favicon.ico - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 404 0 0 140
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:15:39
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:15:39 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:15:39 10.9.20.237 GET /static/AIG-Logo.png - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 304 0 0 0
2022-05-30 06:15:39 10.9.20.237 GET /favicon.ico - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 404 0 0 2
2022-05-30 06:15:59 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:16:01 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:16:17 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 164
2022-05-30 06:17:50 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 1
2022-05-30 06:17:58 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 67
2022-05-30 06:19:01 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:19:06 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 63
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:19:39
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:19:39 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:19:44 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 65
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:20:32
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:20:32 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 4
2022-05-30 06:20:35 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 64
2022-05-30 06:22:51 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:23:04 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 100

How to redirect with headers

How i can redirect after my loginPost method with header Authorization(my jquery code):

$(document).ready(function (){

    $("#form-login").submit(function (event){
        event.preventDefault();

        let $form = $(this),
            email = $form.find("input[name='email'").val(),
            password = $form.find("input[name='password'").val();

        loginPost(email, password);

    })

    function loginPost(email, password) {
        $.ajax({
            url:"/api/auth/login",
            type:"POST",
            async:false,
            data: {email, password},
            success: function (data) {
                let urlLogin;
                if(data["role"] === "ROLE_USER") {
                    urlLogin = "/api/user"
                } else {
                    urlLogin = "/api/admin"
                }
                $.ajax({
                    url:urlLogin,
                    type:"GET",
                    async: false,
                    headers: {
                        "Authorization": "Bearer "+data["token"]
                    }
                })
            }
        })
    }

Thymeleaf ViewController :

@Controller
@RequestMapping("/api")
public class ViewController {

   @PreAuthorize("hasRole('ROLE_USER')")
   @RequestMapping("/user")
   public String userPage() {
       return "user_page";
   }
   
   @PreAuthorize("hasRole('ROLE_ADMIN')")
   @GetMapping("/admin")
   public String adminPage() {
       return "admin_page";
   }

}

After get request i have only response with hmtl page, but i need to redirect get route with rendering this page.
If i doing window.location=”/api/user” i have response 401.

caroussel not displaying image in JS

i’ve a problem with my caroussel in JS
He just don’t recognize my innerHTML, in fact when i look on the inspector, he don’t recognize the on my innerHTML, i’ve done some research and didn’t found anything (showing

<img src = unknown/>. 

My img array is an url array not in any folder.

Here’s what i already have

 function slideShow() {
  var counter = 0;
  slideShow();
  const diapoImages = [
    "https://images.unsplash.com/photo-1652044049927-7142ea82c81d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80",
    "https://images.unsplash.com/photo-1639718561716-b59d3995d886?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80",
    "https://images.unsplash.com/photo-1653593349937-1a2a29a614d2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1742&q=80",
    "https://images.unsplash.com/photo-1653629154297-d01874fe01c7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80",
    "https://images.unsplash.com/photo-1653537649117-821e01f707c2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80",
  ];

  var imgDiv = document.getElementById("header");

  if (counter < diapoImages.length) {
    var img = diapoImages[counter];
    imgDiv.innerHTML = `<img src=${img}/>`;
    counter += 1; 
  }
  else {
    counter = 0; 
  }
  setTimeout(slideShow, 5000)
}

here’s the HTML

    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://kit.fontawesome.com/c9b7852654.js" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="css/style.css">
    <title>Diaporama</title>
</head>
<body>
    <i id = "nav-gauche" class="fa-solid fa-arrow-left-long"></i>
    <i id = "nav-droite" class="fa-solid fa-arrow-right-long"></i>
<div class="container">
    <h1>Javascript Caroussel</h1>
    <h2>Test d'un caroussel en JS</h2>
    <div id="header">

    </div>
</div>
<script src=""></script>
</body>
</html>

backbone.js this.listenTo() not working properly

I have a model this.options.image that has attributes something like this

{title: 'test'
id : 2}

And I use this.listenTo(this.options.image.attributes.id, 'change' this.function()) so that this.function() is called when there is a change in the id of the image. However for some reason, the callback function ends up being called even if there is no change in the id of the image yet. Am I misunderstanding how this.listenTo works for backbone? Is there another way I can go about doing this?

Raycaster with threejs and draw points on the plane by clicking

Hellow everyone ,I had some question with my procedure about threejs with Raycaster
I add a plane to scene and I want to draw a point by clicking on the plane,but the DOM don’t fill the screen

Here is my selection handler, used in vue.js:

const canvas = this.$refs.dreamview.getBoundingClientRect();
const pointer = new THREE.Vector2();
pointer.x =((event.clientX - canvas.left) /canvas.width) *2 1;
pointer.y =-((event.clientY - canvas.top) /canvas.height) *2 +1;
this.raycaster.setFromCamera(pointer, this.camera);
const intersects = this.raycaster.intersectObjects(scene.children, false);
let plane = intersects.find((e) => e.object.name === "plane");

I get the set of coordinates using the code above,but the plane.point is incorrect,i don’t understand what went wrong;

Thank you all for any advice that you could give on this.

How to add recoilize debugger to react 18 app?

I used ‘create-react-app’, installed “recoil”, and tried a simple example here.
Then I tried to add recoil debugger to the chrome extension. But it doesn’t work and the app crashes with an error. I assume it is because the example is written with “ReactDOM.render” syntax, but React 18 uses “root.render”.

Does anyone know how to fix it?

index.js:

import React from 'react';
import ReactDOM from 'react-dom/client';
import RecoilizeDebugger from 'recoilize';
import { RecoilRoot } from 'recoil';

import './index.css';
import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(
  <React.StrictMode>
    <RecoilRoot>
      <App />
      <RecoilizeDebugger />r
    </RecoilRoot>
  </React.StrictMode>
);

enter image description here

Unable to fill src value using JS in iframe

<!DOCTYPE html>
<html>

<body style="text-align:center;">
    <iframe id="gfgFrame" src=""
        style="height: 50vh; width: 600px;">
    </iframe>

    <input type="text" id = "xxx">
  <p id = "u"></p>
    <button onclick="navigate()">
        Click it
    </button>

    <script>
    var url = document.getElementById("xxx");
        function navigate() {
            document.getElementById("gfgFrame").setAttribute("src", url);
      document.getElementById("u").innerHTML = "Hello";
    }
    </script>
</body>

</html>

If I enter a URL, it’s not working.
I have seen solutions on stackoverflow. I have also tried the other method, which is

    <script>
var url = document.getElementById("xxx");
       function navigate() {
            document.getElementById("gfgFrame").src
                = url;
        }
    </script>

Please forgive my intendation. Can anyone tell me where I’m going wrong?

How to make binary search work with strings?

This binary search works with numbers, but not working with stings

 function binary_search(Array, key) {
   
   var middleIndex = Math.floor(Array.length / 2)
   var middleValue = numberArray[middleIndex]


   //base case key = middle element
   if (middleValue === key) return true


   else if (middleValue < key && Array.length > 1) {
       return binary_search(Array.splice(middleIndex, Array.length), key)
   }

   else if (middleValue > key && Array.length > 1)  {
      return binary_search(Array.splice(0, middleIndex), key)
   }

 else return false


}

If I give it numbers, it works:

console.log(binary_search([5,7,12,16,36,39,42,56,71], 36))
output: true

But not with strings:

console.log(binary_search(['cat', 'dog', 'bird', 'fish'], 'dog'))
result : flase

I understand the array must be presorted for this to work, but how to do this with strings?

Javascript image slider tutorial: “TypeError: slides is null”

I have followed a tutorial to make an image slider and have everything copied to a T (or so I thought) but in the tutorial it works at this point where-as mine does nothing.

Developer tools debugger flags the error “TypeError: slides is null”, with reference to line 10, line 4 and line 3.

I’ve triple checked that I haven’t made any typos and that it’s all copied out exactly as in the tutorial, but it’s still not working.

I’m new to Javacsript and I need to get something like this working for a project and I’m in over my head so I sincerely apologise if this is a silly question. Any help greatly appreciated.

const buttons = document.querySelectorAll("[data-carousel-button]")

buttons.forEach(button => {
    button.addEventListener("click", () => {
        const offset = button.dataset.carouselButton === "next" ? 1 : -1
        const slides = button
            .closest("[data-carousel]")
            .querySelector("data-slides")

        const activeSlide = slides.querySelector("[data-active]")
        let newIndex = [...slides.children].indexOf(activeSlide) + offset
        if (newIndex < 0) newIndex = slides.children.length - 1
        if (newIndex >=  slides.children.length) newIndex = 0

        slides.children[newIndex].dataset.active = true
        delete activeSlide.dataset.active
    })
})
* *::before, *::after {
    padding:0;
    margin:0;
    box-sizing: border-box;
}

.carousesl {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.slide > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit:cover;
    object-position: center;

}

.slide[data-active] {
    opacity:1;
}

.carousel-button {
    position: absolute;
    background: none;
    border: none;
    font-size: 4rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: rgba(255, 255, 255, .5);
    cursor: pointer;
    border-radius: .25rem;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, .1);
}

.carousel-button:hover,
.carousel-button:focus {
    color: white;
    background-color: rgba(0, 0, 0, .2);
}

.carousel-button.next {
    left: 1rem;
}
.carousel-button.prev {
    right: 1rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS Image Slider</title>
    <link rel="stylesheet" href="styles.css">
    <script src="script.js" defer></script>
</head>
<body>
    <section aria-label="Project Photos">
        <div class="carousel" data-carousel>
            <button class="carousel-button prev" data-carousel-button="prev">&#x1F86A;</button>
            <button class="carousel-button next" data-carousel-button="next">&#x1F868;</button>
            <ul data-slides>
                <li class="slide" data-active>
                    <img src="https://images.unsplash.com/photo-1653629154029-265d18f0e1f5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80" alt="Nature image #1">
                </li>
                <li class="slide">
                    <img src="https://images.unsplash.com/photo-1629447236132-22c57cd0f0bf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1932&q=80" alt="Nature image #2">
                </li>
                <li class="slide">
                    <img src="https://images.unsplash.com/photo-1653161926463-725f4b39a739?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1742&q=80" alt="Nature image #3">
                </li>
                <li class="slide">
                    <img src="https://images.unsplash.com/photo-1653422064161-a2e82924adbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1932&q=80" alt="Nature image #4">
                </li>
                <li class="slide">
                    <img src="https://images.unsplash.com/photo-1629447236132-22c57cd0f0bf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1932&q=80" alt="Nature image #5">
                </li>
            </ul>
        </div>
    </section>
</body>
</html>

HTML select only outputs a few things

I want to make a select using https://tom-select.js.org/ and when I give it the options it only shows me some of them

                    <div class="col-md-6 pb-4">
                        <div class="d-flex">
                          <select id="select" placeholder="Law Area..." autocomplete="off" style="width:500px">
                                <option value="">Law Area</option>
                                    <option value="Advertising & Product Regulatory">Advertising & Product Regulatory</option>
                                <option value="Banking & Finance">Banking & Finance</option>
                                <option value="Banking Litigation">Banking Litigation</option>
                                <option value="Blockchain & Smart Contracts">Blockchain & Smart Contracts</option>
                                <option value="Capital Markets">Capital Markets</option>
                                <option value="Charities & Not-for-Profits">Charities & Not-for-Profits</option>
-----CUT FOR SIZE-----
                                <option value="Data Privacy & Protection">Data Privacy & Protection</option>
                                <option value="Business Law">Business Law</option>
                                <option value="Conveyancing & Support">Conveyancing & Support</option>
                                <option value="Immigration Law">Immigration Law</option>
                                <option value="Personal Injury">Personal Injury</option>
                                <option value="Wills & Trust, Estate">Wills & Trust, Estate</option>
                                <option value="Planning, and Probate">Planning, and Probate</option>
                                </select>
                        </div>
                    </div>
                    <script>
                  new TomSelect("#select",{
                    create: true,
                    sortField: {
                      field: "text",
                      direction: "asc"
                    }
                  });
                    </script>

Is there any limit of how many elements you can add in ?

JavaScript – Converting string-array to an array of strings

I have the following input which I receive:

const myString = "['one', 'two']";

When I run the following command:

console.log(typeof myString);

I get string

This makes sense, as this is a string input. The input type is out of my control, I must receive this as a typeof string.

However, I would like to convert this string, into a formal array of strings.

For example:

const myArray = ['one', 'two'];

So, when I run:

console.log(typeof myArray);

I get object.

I have tried JSON.parse() and JSON.stringify but to no luck.

The basics of my question are how do I (in JavaScript) convert a string array, into an array of strings?

PIXI.Graphics vertices resolution

When using the PIXI.Graphics class to draw shapes, I discovered a huge performance boost by drawing my shapes a fraction of the wanted size and scaled it back to fullscreen, because of the reduction of the number of vertices used to draw the shape.

I wonder if there is a more direct way to tell PIXI to draw shapes with a reduced resolution/with less vertices? I could not find anything in the docs.

Any idea to achieve this?
Thank you!