Rescreva essa parte da string com as seguintes condições: 1. Não elimine NENHUMA…
- User
Rescreva essa parte da string com as seguintes condições: 1. Não elimine NENHUMA informação dada no artigo. 2. Conceitos, termos ou referências devem ser mantidas em inglês. 3. Apenas transcreva o artigo para um inglês simples, sem alterar o contexto. 4. Não remova as tags HTML e nem os "#thedivisor#". 5. Você deve me enviar sua resposta em texto puro, sem markdown.
#thedivisor#You’ll learn how to fix this error later on this page. Before we get to that, let’s add some structure to your data.#thedivisor#This data can be structured even more.#thedivisor#Let’s say you want a way to only show people whose profession is <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">'chemist'</code>. You can use JavaScript’s <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">filter()</code> method to return just those people. This method takes an array of items, passes them through a “test” (a function that returns <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">true</code> or <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">false</code>), and returns a new array of only those items that passed the test (returned <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">true</code>).#thedivisor#You only want the items where <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">profession</code> is <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">'chemist'</code>. The “test” function for this looks like <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">(person) => person.profession === 'chemist'</code>. Here’s how to put it together:#thedivisor#<li class="leading-relaxed mb-1"><strong class="font-bold">Create</strong> a new array of just “chemist” people, <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">chemists</code>, by calling <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">filter()</code> on the <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">people</code> filtering by <code dir="ltr" class="inline text-code text-secondary dark:text-secondary-dark px-1 rounded-md no-underline bg-gray-30 bg-opacity-10 py-px">person.profession === 'chemist'</code>:</li> - Assistant
#thedivisor#You will learn how to fix this error later on this page. Before that, let’s add some structure to your data.#thedivisor#This data can be organized even more.#thedivisor#Let’s say you want a way to only show people whose profession is 'chemist'. You can use JavaScript’s filter() method to get just those people. This method takes an array of items, runs them through a “test” (a function that gives back true or false), and provides a new array with only those items that passed the test (returned true).#thedivisor#You only want the items where profession is 'chemist'. The “test” function for this looks like (person) => person.profession === 'chemist'. Here’s how to put it together:#thedivisor#Create a new array of just “chemist” people, chemists, by calling filter() on the people filtering by person.profession === 'chemist':