Skip to content

Tag: javascript

Vue v-model and @keydown in one element

I need to solve 1 problem, my v-model ticker I guess works after keydown, therefore when function is called I have into it ticker without 1 symbol, can anyone explain how it works? Answer You should use @input event to get the current input value :

Why function returns filtered boolean array

I learn js and trying to write filter method without using it. So I need to my function return filtered array based on function, which passed as a parameter. And it does but it’s returned boolean array and I don’t understand why. My code: Calling with some numbers: myFilter([2, 5, 1, 3, 8, 6], fun…

How can I bring a HTML Image to the backend?

I have a middleware: which logs me (image): my API-Call in the backend looks like: it logs me: Answer First of all, you are doing a GET request. You can’t post data to a /GET endpoint. You need a /POST. Secondly, req.query is an object of key-value pairs of query parameters, which in your case is rightf…

How to get element of least time in array?

I have an array of of objects: And I need to write a function that get an item of the least time in array. Output shoulde be like this: {videoStartTime: “2022-08-17T11:11:05.000Z”} Thanks! Answer Sorting the whole list for the minimum is very slow; you can use .reduce() instead to linear search:

How do I properly make click event on fetched “buttons”?

I fetch all users from database via this code After they fetched, I generate an element and add that element to the list. That works fine, but! I have this part of code In my logic, after elements generated, and window loaded, all items with class users__user-field must have a click event to toggle selected c…