Questions tagged [each]
An iterator function or language struct which can be used to iterate over arrays or lists.
3,796
questions
0
votes
0
answers
29
views
For Each Loop for ActiveX Checkboxes in MS Word VBA
I am trying to make a Word Document that will move a textbox (Just a shape in word) using a reference State Code that is a value from a Text Box (ActiveX) to a different Word Document. The State Code, ...
0
votes
1
answer
19
views
How to pick a new color for each plotted line in matplotlib?
I have a small problem with the colors when I make a loop for to create my lines
Can you help me please?
I would like to change the color of each line
data = {'Note':['3','3','3','4','4','4','5','5','...
-1
votes
0
answers
34
views
Problem with running a script to extract and convert a JSON object
<script>
$(document).ready(function() {
var chains = ["arb", "astar", "aurora", "avax", "boba", "bsc", "btt", "...
0
votes
2
answers
31
views
Cypress.io Iterate list of elements to see if text does not exist, then perform action to add element
I'm trying to iterate over a list (<UL>) to see whether or not a specific string exists within the <li> list item elements. If the string (Lemon in this example) does not exist then I ...
0
votes
1
answer
33
views
svelte recursively create treeview from unknown object
I am coding some kind of primitive CMS just for editing, updating and adding new strings of an app.
the strings are all stored in a database and each of them have a special key (representing the ...
0
votes
2
answers
35
views
Azure pipeline EACH issue
I found a lot of examples about using EACH loop in an Azure pipeline, but all of them I found are using a parameter as the array.
What about using an array that was created in the code?
I mean:
- ...
0
votes
0
answers
22
views
Why does Javascript not recognize global variable outside of each? [duplicate]
I am trying to gradually populate an array inside an each function like this:
$('#reference-select').change(function () {
var intensity_list = new Array();
var angle_list = new ...
-1
votes
1
answer
37
views
Jest + React: it.each() await for variable
i have this code in a jest file with react:
import React from 'react';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import ReactDOM from 'react-dom/client';
import { ...
0
votes
1
answer
79
views
How can I dynamically add and remove Svelte components in an each block?
Consider that I have some array of objects, from which things may be added and removed. For each object, I want a Svelte component rendered.
If an object is removed, I want its corresponding Svelte ...
0
votes
0
answers
17
views
I am using Pug for my node.js app, how can I print the data of two Web API arrays into one for each loop?
This is my code:
table.w3-table-all.w3-centered
tr
th Name
th Symbol
th Coin
th Test
each coin in data.data
...
1
vote
2
answers
66
views
Why "Type of argument to each on reference must be unblessed hashref or arrayref at test.pl line 17."?
I don't understand the error message
Type of argument to each on reference must be unblessed hashref or arrayref at test.pl line 17.
for this test case (extracted from a larger module):
BEGIN { our $...
0
votes
0
answers
9
views
I have been working ecomerce project and using bhs as a template.data can not be visible by using each loop of hbs
I am using node.js and mongodb for this project
Wile using each loop and {{this.name}} it says that..
Access has been denied to resolve the property "name" because it is not an "own ...
0
votes
2
answers
31
views
Add/Remove class to header when is over a section with class
I'm trying to add/remove a class to the sticky header, when this reaches a specific section with a class "dark-section", but i want to do it automaticly if there are 2 or more section with ...
0
votes
0
answers
32
views
last row value gets selected in all rows select tag
Here when i load the page there are multiple rows where each row contain an select tag with multiple option values and my problem is all rows select tag is getting selected the last loop value. for ...
0
votes
0
answers
37
views
Exit from Jquery $.each loop which has function call and if statements inside it
I want to exit out of the jquery $.each loop when when the exit variable in my function is 1.
Below is the API response :
{
"data": [{
"name": "rotate",
...
0
votes
0
answers
11
views
How to use diffForHumans() in laravel using jquery loop? [duplicate]
$.each(response.comments, function(key, value) {
$("#commentsShow").append('<p class="fivem">' + value.comment + '</p><p class="mb-0">' + value....
0
votes
2
answers
42
views
nested if statements javascript
I'm trying to do a lookup until i found an especific value; currently using if statements like this but right now its only two levels and i dont need how many if statements will be needed until the ...
0
votes
1
answer
59
views
How to access original collection and bind to context while iterating over an array?
In this exercise, we're asked to write a function that replicates the behaviour of _.each (UnderscoreJS) and that passes a series of unit tests.
// COLLECTIONS
// _.each(collection, iteratee, [context]...
0
votes
0
answers
21
views
Use of this in jQuery find() and .each() [duplicate]
I have an example where I use jQuery to get and replace titles attribute of images. ( I change title attribute for the purpose of translation). Here an example, that works, but I can not understand ...
0
votes
4
answers
47
views
how to take only times from dates inside array in rails
so... i need to take times from dates inside Array
so for example I have an array like this
a = [
Thu, 17 Mar 2022 10:00:00.000000000 KST +09:00,
Thu, 17 Mar 2022 10:00:00.000000000 KST +...
0
votes
1
answer
63
views
Create an iteration of carousel cards upon clicking on next button (CYPRESS)
Guys I am trying to make an .each() iteration of carousel cards. So what I am trying to do is that I land on page and then I see carousel and I press on ">" button and new cards pops up (...
0
votes
0
answers
10
views
[vba][excel] RefEdit make two selections
I have a RefEdit form into which I enter 36 rows of data. The data are then entered into a 36 x 36 matrix. Task 1 is to put the first 18 rows from RefEdit into row 0 of the matrix. Task 2 is to enter ...
2
votes
1
answer
45
views
JavaScript/jQuery: How to run a function after an each() loop has finished?
I have the following. What is basically happening is I'm prefilling all the dropdowns/select options. I then retrieve the data for the current record and select the appropriate value for each dropdown/...
1
vote
0
answers
30
views
Refactoring nested each loop in Ruby
I need to do a search comparing two hashs
I use an each to iterate over a hash and b_search to do the binary search:
@player.each do |player|
player_support_search = players_support.bsearch { |...
0
votes
0
answers
18
views
Can I separate the range in VBA?
Here is the Excel macro to sum the range with same font color.
I'd like to separate the sumRange into range of checking font color and range of getting value for summation. Is it possible?
Function ...
1
vote
1
answer
54
views
cypress .next at end of list yields '' but I need to break instead
I am writing Cypress tests for an application that has a dynamic group/list of items. Each item has a details link that when clicked creates a popup with said details. I need to close that popup and ...
0
votes
0
answers
29
views
adding key values inside of an array of hashes using .each
I'm wondering what the easiest method for adding 'string' values in an array of hashes using an each statement?
lost_boys = [
{name: 'Tootles', age: '11'},
{name: 'Nibs', age: '9'},
{name: ...
-1
votes
2
answers
92
views
How to iterate through the all the body objects
I want to assert if my response.body does not contain some provided value. The body has let's assume 10 objects. All the objects have "id" field. How to use some kind of each or forEach on ...
0
votes
1
answer
119
views
Svelte: Pass and bind data to child component in each loop
I am heavily confused about passing props to a component within a loop in Svelte. The behavior I expected of the code snippet below is that a change in the store variable files triggers re-rendering ...
1
vote
2
answers
36
views
Loop through each div of containers and compare the height on the base of index number
I am trying to loop through 2 main divs and their child divs too. Here is the code sample:
<div class="containers">
<div class="columns">Content 1</div>
&...
-1
votes
1
answer
48
views
Loop through each div of containers and compare the height index wise
Really sorry if there is any mistake in typo for title. But I need help in looping through 2 main divs and their child divs too. Here is the code sample:
<div class="containers">
&...
0
votes
1
answer
57
views
d3.js - Tooltips only shows the first properties values of the data object
First things first, you can play with all the code of the component and the data here: CodeSandBox
I have a Timeline component in d3, and for each one of the circles I want to show the respective ...
0
votes
1
answer
44
views
Javascript: Why does my every() method return false when all the values of the array appear to meet the methods criteria?
I am trying to understand why the every method I am using returns a false boolean value. Here is my code:
let box1 = document.querySelector(`.box1`);
let box2 = document.querySelector(`.box2`);
let ...
1
vote
2
answers
101
views
How to update code that uses deprecated each()
I'm trying to update a piece of old code (a menu builder class). I've updated everything else but I'm stuck at a line that uses the each() function. I did read some of the previous threads but this ...
1
vote
1
answer
49
views
Handlebars HBS Express - How to iterate an object without specify the properties
I am trying to iterate using the properties of an object to dynamically print a table having an array with the properties and an object with the values of each property.
I don't know how to do the 2 ...
0
votes
0
answers
76
views
How do I stop all other Plyr instances except this one
I set up this little javascript to initialize a couple of players on my webpage and add an event to make only one player active while everything else is paused. This is supposed to emulate the "...
0
votes
0
answers
26
views
Handlebars js rendering ends short with big data sets
I am working with express and handlebars
I have encountered this problem several times now and I cannot find any mention of it anywhere.
I always encounter this problem with code inside a script tag, ...
0
votes
2
answers
43
views
Each click add some data from object to div
I have a button and empty div in HTML.
<button id="add_sentence">Click here!</button>
<div id="parent"></div>
In JS, I have data in array
let data = [{ ...
-1
votes
2
answers
132
views
jQuery Each Loop to push data into JSON Object
Can anyone suggest what I am doing wrong here. I have several elements on screen with class .cp_select. I need to loop through them and grab the attributes of "x" and "y". This by ...
0
votes
1
answer
34
views
run a jquery function inside a div and not in the other
I'm working on a pretty simple html/jquery quiz. It will have multiple questions with multiple answers. Every time an answer (".question-option") is chosen inside a question (".question&...
0
votes
1
answer
102
views
Cypress trigger does not hold the click two times in same each loop
I'm trying to delete a record that is inside an "each" loop. It is deleted the first time each runs, but the second time, it just clicks but doesn't hold it.
cy.get('pc-fonts-manager-list')....
2
votes
0
answers
26
views
Using jQuery contains with array [closed]
Instead of writing this a bunch of times (which works):
$('.this--class:contains("Some text")').parent().clone().appendTo($(".other--class"));
$('.this--class:contains("Other ...
1
vote
1
answer
106
views
Reduce method in the stock picker exercise?
The problem gives an array where each index is the price of a stock in each day:
array = [17,3,6,9,15,8,6,1,10]
For example, 1st of November the price is $17, 2nd of November the price is $3, 3rd of ...
-1
votes
2
answers
59
views
Manipulating HTML to get data from JSON file and rewrite DOM
I have multiple links in my HTML looking like this:
<a class="wrapper" href="javascript:FindSKU('12345')" target="_blank">TEST</a>
How do I find the number ...
2
votes
1
answer
48
views
jquery display letter one by one with time out
I tried to split alle letters and display one by one with timeout. I found some solution but they seem not working for me.
This script appends a complete layer (word) but jumps over the each loop. The ...
0
votes
0
answers
128
views
create a const for each item of an array in jquery
I'm trying to create a const or a var for each array item using jQuery, below is my HTML
<div class="taxonomy-list">
<input type="hidden" id="filters-category"&...
0
votes
0
answers
71
views
how to get a specific key from the ruby hash
mike = {:911=>{"Id"=>"123"}}
sam = {:sam_id=>"911", :sam_age=>"30", :sam_location=>"location", :sam_phone=>[{:no_1=>{:no_2=>&...
0
votes
1
answer
89
views
Thymeleaf each loop giving errors
I am trying to print errors on webpage loginform.html but th:each="e:${#fields.errors('email')}" th:text="${e}"
here is my loginform.html code
<!doctype html>
<html lang=&...