diff --git a/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.md b/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.md index 443b82542f..f9997d429f 100644 --- a/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.md +++ b/curriculum/challenges/espanol/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.md @@ -36,7 +36,7 @@ El elemento `div` con clase `cyan` debe tener un `background-color` cian. assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)'); ``` -El elemento `div` con clase `raspberry` debe tener un `background-color` naranja. +El elemento `div` con clase `raspberry` debe tener un `background-color` frambuesa. ```js assert($('.raspberry').css('background-color') == 'rgb(255, 0, 127)'); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/connect-redux-to-react.md b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/connect-redux-to-react.md index 731a208182..b016ed7ef1 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/connect-redux-to-react.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/connect-redux-to-react.md @@ -12,7 +12,9 @@ Now that you've written both the `mapStateToProps()` and the `mapDispatchToProps To use this method, pass in the functions as arguments, and immediately call the result with your component. This syntax is a little unusual and looks like: -`connect(mapStateToProps, mapDispatchToProps)(MyComponent)` +```js +connect(mapStateToProps, mapDispatchToProps)(MyComponent) +``` **Note:** If you want to omit one of the arguments to the `connect` method, you pass `null` in its place. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/extract-state-logic-to-redux.md b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/extract-state-logic-to-redux.md index 15ba65940a..6718ed802e 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/extract-state-logic-to-redux.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/extract-state-logic-to-redux.md @@ -12,7 +12,7 @@ Now that you finished the React component, you need to move the logic it's perfo # --instructions-- -First, define an action type 'ADD' and set it to a const `ADD`. Next, define an action creator `addMessage()` which creates the action to add a message. You'll need to pass a `message` to this action creator and include the message in the returned `action`. +First, define an action type `ADD` and set it to a const `ADD`. Next, define an action creator `addMessage()` which creates the action to add a message. You'll need to pass a `message` to this action creator and include the message in the returned `action`. Then create a reducer called `messageReducer()` that handles the state for the messages. The initial state should equal an empty array. This reducer should add a message to the array of messages held in state, or return the current state. Finally, create your Redux store and pass it the reducer. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/moving-forward-from-here.md b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/moving-forward-from-here.md index 77ef3860f5..b7921af1cc 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/moving-forward-from-here.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/moving-forward-from-here.md @@ -10,9 +10,7 @@ dashedName: moving-forward-from-here Congratulations! You finished the lessons on React and Redux. There's one last item worth pointing out before you move on. Typically, you won't write React apps in a code editor like this. This challenge gives you a glimpse of what the syntax looks like if you're working with npm and a file system on your own machine. The code should look similar, except for the use of `import` statements (these pull in all of the dependencies that have been provided for you in the challenges). The "Managing Packages with npm" section covers npm in more detail. -Finally, writing React and Redux code generally requires some configuration. This can get complicated quickly. If you are interested in experimenting on your own machine, the - -[Create React App](https://github.com/facebookincubator/create-react-app) comes configured and ready to go. +Finally, writing React and Redux code generally requires some configuration. This can get complicated quickly. If you are interested in experimenting on your own machine, the Create React App comes configured and ready to go. Alternatively, you can enable Babel as a JavaScript Preprocessor in CodePen, add React and ReactDOM as external JavaScript resources, and work there as well. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/use-provider-to-connect-redux-to-react.md b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/use-provider-to-connect-redux-to-react.md index f286f16b2e..dfef55cdd2 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/use-provider-to-connect-redux-to-react.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react-and-redux/use-provider-to-connect-redux-to-react.md @@ -64,7 +64,7 @@ assert( ); ``` -The `DisplayMessages` component should render an h2, input, button, and `ul` element. +The `DisplayMessages` component should render an `h2`, `input`, `button`, and `ul` element. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/render-state-in-the-user-interface-another-way.md b/curriculum/challenges/espanol/03-front-end-libraries/react/render-state-in-the-user-interface-another-way.md index e1dd33ed04..21f59401e8 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/render-state-in-the-user-interface-another-way.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/render-state-in-the-user-interface-another-way.md @@ -1,6 +1,6 @@ --- id: 5a24c314108439a4d4036172 -title: Render State in the User Interface Another Way +title: Otra manera de renderizar el estado en la interfaz de usuario challengeType: 6 forumTopicId: 301408 dashedName: render-state-in-the-user-interface-another-way @@ -8,17 +8,17 @@ dashedName: render-state-in-the-user-interface-another-way # --description-- -There is another way to access `state` in a component. In the `render()` method, before the `return` statement, you can write JavaScript directly. For example, you could declare functions, access data from `state` or `props`, perform computations on this data, and so on. Then, you can assign any data to variables, which you have access to in the `return` statement. +Hay otra manera de acceder al `state` de un componente. En el método `render()`, antes de la sentencia `return`, se puede escribir JavaScript directamente. Por ejemplo, puedes declarar funciones, acceder a datos de `state` o `props`, realizar cálculos sobre estos datos, etc. Luego, puedes asignar cualquier dato a las variables, a las que tienes acceso en la sentencia `return`. # --instructions-- -In the `MyComponent` render method, define a `const` called `name` and set it equal to the name value in the component's `state`. Because you can write JavaScript directly in this part of the code, you don't have to enclose this reference in curly braces. +En el método de renderización de `MyComponent`, define una `const` llamada `name` y ponlo igual al valor del nombre en el `state` del componente. Debido a que puedes escribir JavaScript directamente en esta parte del código, no tienes que incluir esta referencia entre llaves. -Next, in the return statement, render this value in an `h1` tag using the variable `name`. Remember, you need to use the JSX syntax (curly braces for JavaScript) in the return statement. +A continuación, en la sentencia return, renderiza este valor en una etiqueta `h1` usando la variable `name`. Recuerda, necesitas usar la sintaxis JSX (llaves para JavaScript) en la sentencia return. # --hints-- -`MyComponent` should have a key `name` with value `freeCodeCamp` stored in its state. +`MyComponent` debe tener una clave `name` con valor `freeCodeCamp` almacenado en su estado. ```js assert( @@ -27,7 +27,7 @@ assert( ); ``` -`MyComponent` should render an `h1` header enclosed in a single `div`. +`MyComponent` debe renderizar un encabezado `h1` incluido en un solo `div`. ```js assert( @@ -37,14 +37,14 @@ assert( ); ``` -The rendered `h1` tag should include a reference to `{name}`. +La etiqueta `h1` renderizada debe incluir una referencia a `{name}`. ```js (getUserInput) => assert(/
markup
}` +```jsx +{condition &&markup
} +``` If the `condition` is `true`, the markup will be returned. If the condition is `false`, the operation will immediately return `false` after evaluating the `condition` and return nothing. You can include these statements directly in your JSX and string multiple conditions together by writing `&&` after each one. This allows you to handle more complex conditional logic in your `render()` method without repeating a lot of code. @@ -73,7 +75,7 @@ async () => { }; ``` -The render method should use the && logical operator to check the condition of this.state.display. +The render method should use the `&&` logical operator to check the condition of `this.state.display`. ```js (getUserInput) => assert(getUserInput('index').includes('&&')); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md index 6efebc2ddb..d9bccebbf2 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-advanced-javascript-in-react-render-method.md @@ -14,7 +14,7 @@ You can also write JavaScript directly in your `render` methods, before the `ret # --instructions-- -In the code provided, the `render` method has an array that contains 20 phrases to represent the answers found in the classic 1980's Magic Eight Ball toy. The button click event is bound to the `ask` method, so each time the button is clicked a random number will be generated and stored as the `randomIndex` in state. On line 52, delete the string `"change me!"` and reassign the `answer` const so your code randomly accesses a different index of the `possibleAnswers` array each time the component updates. Finally, insert the `answer` const inside the `p` tags. +In the code provided, the `render` method has an array that contains 20 phrases to represent the answers found in the classic 1980's Magic Eight Ball toy. The button click event is bound to the `ask` method, so each time the button is clicked a random number will be generated and stored as the `randomIndex` in state. On line 52, delete the string `change me!` and reassign the `answer` const so your code randomly accesses a different index of the `possibleAnswers` array each time the component updates. Finally, insert the `answer` const inside the `p` tags. # --hints-- diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md index 2d8c9a7a2c..9aa54c9672 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-array.filter-to-dynamically-filter-an-array.md @@ -10,7 +10,9 @@ dashedName: use-array-filter-to-dynamically-filter-an-array The `map` array method is a powerful tool that you will use often when working with React. Another method related to `map` is `filter`, which filters the contents of an array based on a condition, then returns a new array. For example, if you have an array of users that all have a property `online` which can be set to `true` or `false`, you can filter only those users that are online by writing: -`let onlineUsers = users.filter(user => user.online);` +```js +let onlineUsers = users.filter(user => user.online); +``` # --instructions-- @@ -27,7 +29,7 @@ assert.strictEqual( ); ``` -`MyComponent`'s state should be initialized to an array of six users.") +`MyComponent`'s state should be initialized to an array of six users. ```js assert( @@ -81,7 +83,7 @@ assert( })(); ``` -`MyComponent` should render `li` elements that contain the username of each online user. +`MyComponent` should render `li` elements that contain the `username` of each online user. ```js (() => { diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md index 49abf8b2c9..2c6a725994 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-proptypes-to-define-the-props-you-expect.md @@ -12,7 +12,9 @@ React provides useful type-checking features to verify that components receive p It's considered a best practice to set `propTypes` when you know the type of a prop ahead of time. You can define a `propTypes` property for a component in the same way you defined `defaultProps`. Doing this will check that props of a given key are present with a given type. Here's an example to require the type `function` for a prop called `handleClick`: -`MyComponent.propTypes = { handleClick: PropTypes.func.isRequired }` +```js +MyComponent.propTypes = { handleClick: PropTypes.func.isRequired } +``` In the example above, the `PropTypes.func` part checks that `handleClick` is a function. Adding `isRequired` tells React that `handleClick` is a required property for that component. You will see a warning if that prop isn't provided. Also notice that `func` represents `function`. Among the seven JavaScript primitive types, `function` and `boolean` (written as `bool`) are the only two that use unusual spelling. In addition to the primitive types, there are other types available. For example, you can check that a prop is a React element. Please refer to the [documentation](https://reactjs.org/docs/jsx-in-depth.html#specifying-the-react-element-type) for all of the options. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/use-state-to-toggle-an-element.md b/curriculum/challenges/espanol/03-front-end-libraries/react/use-state-to-toggle-an-element.md index 534aa278e4..d4b7578928 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/use-state-to-toggle-an-element.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/use-state-to-toggle-an-element.md @@ -42,7 +42,7 @@ Currently, there is no way of updating the `visibility` property in the componen Finally, click the button to see the conditional rendering of the component based on its `state`. -**Hint:** Don't forget to bind the `this` keyword to the method in the constructor! +**Hint:** Don't forget to bind the `this` keyword to the method in the `constructor`! # --hints-- diff --git a/curriculum/challenges/espanol/03-front-end-libraries/react/write-a-simple-counter.md b/curriculum/challenges/espanol/03-front-end-libraries/react/write-a-simple-counter.md index cfc063e0ef..9522c78e54 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/react/write-a-simple-counter.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/react/write-a-simple-counter.md @@ -14,7 +14,7 @@ You can design a more complex stateful component by combining the concepts cover The `Counter` component keeps track of a `count` value in `state`. There are two buttons which call methods `increment()` and `decrement()`. Write these methods so the counter value is incremented or decremented by 1 when the appropriate button is clicked. Also, create a `reset()` method so when the reset button is clicked, the count is set to 0. -**Note:** Make sure you don't modify the `classNames` of the buttons. Also, remember to add the necessary bindings for the newly-created methods in the constructor. +**Note:** Make sure you don't modify the `className`s of the buttons. Also, remember to add the necessary bindings for the newly-created methods in the constructor. # --hints-- diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/copy-an-object-with-object.assign.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/copy-an-object-with-object.assign.md index 95f447d908..9c004ef012 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/copy-an-object-with-object.assign.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/copy-an-object-with-object.assign.md @@ -10,7 +10,9 @@ dashedName: copy-an-object-with-object-assign The last several challenges worked with arrays, but there are ways to help enforce state immutability when state is an `object`, too. A useful tool for handling objects is the `Object.assign()` utility. `Object.assign()` takes a target object and source objects and maps properties from the source objects to the target object. Any matching properties are overwritten by properties in the source objects. This behavior is commonly used to make shallow copies of objects by passing an empty object as the first argument followed by the object(s) you want to copy. Here's an example: -`const newObject = Object.assign({}, obj1, obj2);` +```js +const newObject = Object.assign({}, obj1, obj2); +``` This creates `newObject` as a new `object`, which contains the properties that currently exist in `obj1` and `obj2`. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/create-a-redux-store.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/create-a-redux-store.md index 7881ad686d..4eb9227a82 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/create-a-redux-store.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/create-a-redux-store.md @@ -24,13 +24,13 @@ Declare a `store` variable and assign it to the `createStore()` method, passing # --hints-- -The redux store should exist. +The Redux store should exist. ```js assert(typeof store.getState === 'function'); ``` -The redux store should have a value of 5 for the state. +The Redux store should have a value of 5 for the state. ```js assert(store.getState() === 5); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/define-a-redux-action.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/define-a-redux-action.md index 0c33ade1a0..31f49e2e33 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/define-a-redux-action.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/define-a-redux-action.md @@ -18,7 +18,7 @@ Writing a Redux action is as simple as declaring an object with a type property. # --hints-- -An action object should exist. +An `action` object should exist. ```js assert( @@ -28,7 +28,7 @@ assert( ); ``` -The action should have a key property type with value `LOGIN`. +The `action` object should have a key property `type` with value `LOGIN`. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/define-an-action-creator.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/define-an-action-creator.md index 13f0f279ec..656723c9e1 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/define-an-action-creator.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/define-an-action-creator.md @@ -22,13 +22,13 @@ The function `actionCreator` should exist. assert(typeof actionCreator === 'function'); ``` -Running the `actionCreator` function should return the action object. +Running the `actionCreator` function should return the `action` object. ```js assert(typeof action === 'object'); ``` -The returned action should have a key property type with value `LOGIN`. +The returned `action` should have a key property `type` with value `LOGIN`. ```js assert(action.type === 'LOGIN'); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/get-state-from-the-redux-store.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/get-state-from-the-redux-store.md index c7a02905de..7c348ad330 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/get-state-from-the-redux-store.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/get-state-from-the-redux-store.md @@ -16,7 +16,7 @@ The code from the previous challenge is re-written more concisely in the code ed # --hints-- -The redux store should have a value of 5 for the initial state. +The Redux store should have a value of 5 for the initial state. ```js assert(store.getState() === 5); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/register-a-store-listener.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/register-a-store-listener.md index 56d06178d0..d3d43ced41 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/register-a-store-listener.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/register-a-store-listener.md @@ -32,7 +32,13 @@ assert( There should be a listener function subscribed to the store using `store.subscribe`. ```js -(getUserInput) => assert(getUserInput('index').includes('store.subscribe(')); +(getUserInput) => assert(getUserInput('index').match(/store\s*\.\s*subscribe\(/gm)); +``` + +The `store.subscribe` should receive a function. + +```js +(getUserInput) => assert(getUserInput('index').match(/(\s*function\s*)|(\s*\(\s*\)\s*=>)/gm)) ``` The callback to `store.subscribe` should also increment the global `count` variable as the store is updated. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-const-for-action-types.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-const-for-action-types.md index 5df85e5c20..e34d2505f4 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-const-for-action-types.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-const-for-action-types.md @@ -88,8 +88,9 @@ The `authReducer` function should handle multiple action types with a switch sta ```js const noWhiteSpace = __helpers.removeWhiteSpace(code); assert( - /constLOGIN=(['"`])LOGIN\1/.test(noWhiteSpace) && - /constLOGOUT=(['"`])LOGOUT\1/.test(noWhiteSpace) + (/constLOGIN=(['"`])LOGIN\1/.test(noWhiteSpace) && + /constLOGOUT=(['"`])LOGOUT\1/.test(noWhiteSpace)) || + /const(LOGIN|LOGOUT)=(['"`])\1\2,(?!\1)(LOGIN|LOGOUT)=(['"`])\3\4/.test(noWhiteSpace) ); ``` @@ -117,9 +118,7 @@ The action creators and the reducer should reference the `LOGIN` and `LOGOUT` co ## --seed-contents-- ```js -// Change code below this line -// Change code above this line const defaultState = { authenticated: false @@ -128,11 +127,11 @@ const defaultState = { const authReducer = (state = defaultState, action) => { switch (action.type) { - case 'LOGIN': // Change this line + case 'LOGIN': return { authenticated: true } - case 'LOGOUT': // Change this line + case 'LOGOUT': return { authenticated: false } diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-middleware-to-handle-asynchronous-actions.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-middleware-to-handle-asynchronous-actions.md index 12c66b6acb..9839855204 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-middleware-to-handle-asynchronous-actions.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-middleware-to-handle-asynchronous-actions.md @@ -40,7 +40,7 @@ assert(receivedData('data').type === RECEIVED_DATA); assert(typeof asyncDataReducer === 'function'); ``` -Dispatching the requestingData action creator should update the store `state` property of fetching to `true`. +Dispatching the `requestingData` action creator should update the store `state` property of fetching to `true`. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-the-spread-operator-on-arrays.md b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-the-spread-operator-on-arrays.md index a03547ccb6..68e6f320ac 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/redux/use-the-spread-operator-on-arrays.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/redux/use-the-spread-operator-on-arrays.md @@ -10,9 +10,11 @@ dashedName: use-the-spread-operator-on-arrays One solution from ES6 to help enforce state immutability in Redux is the spread operator: `...`. The spread operator has a variety of applications, one of which is well-suited to the previous challenge of producing a new array from an existing array. This is relatively new, but commonly used syntax. For example, if you have an array `myArray` and write: -`let newArray = [...myArray];` +```js +let newArray = [...myArray]; +``` -`newArray` is now a clone of `myArray`. Both arrays still exist separately in memory. If you perform a mutation like `newArray.push(5)`, `myArray` doesn't change. The `...` effectively *spreads* out the values in `myArray` into a new array. To clone an array but add additional values in the new array, you could write `[...myArray, 'new value']`. This would return a new array composed of the values in `myArray` and the string `'new value'` as the last value. The spread syntax can be used multiple times in array composition like this, but it's important to note that it only makes a shallow copy of the array. That is to say, it only provides immutable array operations for one-dimensional arrays. +`newArray` is now a clone of `myArray`. Both arrays still exist separately in memory. If you perform a mutation like `newArray.push(5)`, `myArray` doesn't change. The `...` effectively *spreads* out the values in `myArray` into a new array. To clone an array but add additional values in the new array, you could write `[...myArray, 'new value']`. This would return a new array composed of the values in `myArray` and the string `new value` as the last value. The spread syntax can be used multiple times in array composition like this, but it's important to note that it only makes a shallow copy of the array. That is to say, it only provides immutable array operations for one-dimensional arrays. # --instructions-- @@ -20,7 +22,7 @@ Use the spread operator to return a new copy of state when a to-do is added. # --hints-- -The Redux store should exist and initialize with a state equal to `[Do not mutate state!]`. +The Redux store should exist and initialize with a state equal to `["Do not mutate state!"]`. ```js assert( diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while.md index 88f02b1441..0e6f582247 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while.md @@ -48,31 +48,31 @@ Your code should increment the counter variable. assert(code.match(/\$(.*)\s*?:\s*\$\1\s*\+\s*1\s*;/gi)); ``` -Your `.text-1` class should have a `font-size` of 15px. +Your `.text-1` class should have a `font-size` of `15px`. ```js assert($('.text-1').css('font-size') == '15px'); ``` -Your `.text-2` class should have a `font-size` of 30px. +Your `.text-2` class should have a `font-size` of `30px`. ```js assert($('.text-2').css('font-size') == '30px'); ``` -Your `.text-3` class should have a `font-size` of 45px. +Your `.text-3` class should have a `font-size` of `45px`. ```js assert($('.text-3').css('font-size') == '45px'); ``` -Your `.text-4` class should have a `font-size` of 60px. +Your `.text-4` class should have a `font-size` of `60px`. ```js assert($('.text-4').css('font-size') == '60px'); ``` -Your `.text-5` class should have a `font-size` of 75px. +Your `.text-5` class should have a `font-size` of `75px`. ```js assert($('.text-5').css('font-size') == '75px'); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/create-reusable-css-with-mixins.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/create-reusable-css-with-mixins.md index d84a69bbc6..0d9d13c6f0 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/create-reusable-css-with-mixins.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/create-reusable-css-with-mixins.md @@ -10,7 +10,7 @@ dashedName: create-reusable-css-with-mixins In Sass, a mixin is a group of CSS declarations that can be reused throughout the style sheet. -Newer CSS features take time before they are fully adopted and ready to use in all browsers. As features are added to browsers, CSS rules using them may need vendor prefixes. Consider "box-shadow": +Newer CSS features take time before they are fully adopted and ready to use in all browsers. As features are added to browsers, CSS rules using them may need vendor prefixes. Consider `box-shadow`: ```scss div { @@ -42,7 +42,7 @@ div { # --instructions-- -Write a mixin for `border-radius` and give it a `$radius` parameter. It should use all the vendor prefixes from the example. Then use the `border-radius` mixin to give the `#awesome` element a border radius of 15px. +Write a mixin for `border-radius` and give it a `$radius` parameter. It should use all the vendor prefixes from the example. Then use the `border-radius` mixin to give the `#awesome` element a border radius of `15px`. # --hints-- @@ -83,7 +83,7 @@ assert( ); ``` -Your code should call the `border-radius mixin` using the `@include` keyword, setting it to 15px. +Your code should call the `border-radius mixin` using the `@include` keyword, setting it to `15px`. ```js assert(code.match(/@include\s+?border-radius\(\s*?15px\s*?\)\s*;/gi)); diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials.md index fa421a0cb0..9262041c3a 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/split-your-styles-into-smaller-chunks-with-partials.md @@ -15,8 +15,6 @@ Names for partials start with the underscore (`_`) character, which tells Sass i For example, if all your mixins are saved in a partial named "\_mixins.scss", and they are needed in the "main.scss" file, this is how to use them in the main file: ```scss -// In the main.scss file - @import 'mixins' ``` diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/store-data-with-sass-variables.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/store-data-with-sass-variables.md index 6829bc9477..b106a6fb84 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/store-data-with-sass-variables.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/store-data-with-sass-variables.md @@ -17,8 +17,11 @@ Here are a couple examples: ```scss $main-fonts: Arial, sans-serif; $headings-color: green; +``` -//To use variables: +And to use the variables: + +```scss h1 { font-family: $main-fonts; color: $headings-color; @@ -29,20 +32,20 @@ One example where variables are useful is when a number of elements need to be t # --instructions-- -Create a variable `$text-color` and set it to red. Then change the value of the `color` property for the `.blog-post` and `h2` to the `$text-color` variable. +Create a variable `$text-color` and set it to `red`. Then change the value of the `color` property for the `.blog-post` and `h2` to the `$text-color` variable. # --hints-- -Your code should have a Sass variable declared for `$text-color` with a value of red. +Your code should have a Sass variable declared for `$text-color` with a value of `red`. ```js -assert(code.match(/\$text-color:\s*?red;/g)); +assert(code.match(/\$text-color\s*:\s*?red\s*;/g)); ``` Your code should use the `$text-color` variable to change the `color` for the `.blog-post` and `h2` items. ```js -assert(code.match(/color:\s*?\$text-color;/g)); +assert(code.match(/color\s*:\s*\$text-color\s*;?/g)); ``` Your `.blog-post` element should have a `color` of red. diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/use-each-to-map-over-items-in-a-list.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/use-each-to-map-over-items-in-a-list.md index 963960aa09..bfdc68db55 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/use-each-to-map-over-items-in-a-list.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/use-each-to-map-over-items-in-a-list.md @@ -44,7 +44,7 @@ Note that the `$key` variable is needed to reference the keys in the map. Otherw # --instructions-- -Write an `@each` directive that goes through a list: `blue, black, red` and assigns each variable to a `.color-bg` class, where the "color" part changes for each item. Each class should set the `background-color` the respective color. +Write an `@each` directive that goes through a list: `blue, black, red` and assigns each variable to a `.color-bg` class, where the `color` part changes for each item. Each class should set the `background-color` the respective color. # --hints-- diff --git a/curriculum/challenges/espanol/03-front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles.md b/curriculum/challenges/espanol/03-front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles.md index 5192bbacba..e13d113b23 100644 --- a/curriculum/challenges/espanol/03-front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles.md +++ b/curriculum/challenges/espanol/03-front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles.md @@ -57,7 +57,7 @@ Your code should declare a mixin named `border-stroke` which has a parameter nam assert(code.match(/@mixin\s+?border-stroke\s*?\(\s*?\$val\s*?\)\s*?{/gi)); ``` -Your mixin should have an `@if` statement to check if `$val` is light, and to set the `border` to 1px solid black. +Your mixin should have an `@if` statement to check if `$val` is `light`, and to set the `border` to `1px solid black`. ```js assert( @@ -67,7 +67,7 @@ assert( ); ``` -Your mixin should have an `@else if` statement to check if `$val` is medium, and to set the `border` to 3px solid black. +Your mixin should have an `@else if` statement to check if `$val` is `medium`, and to set the `border` to `3px solid black`. ```js assert( @@ -77,7 +77,7 @@ assert( ); ``` -Your mixin should have an `@else if` statement to check if `$val` is heavy, and to set the `border` to 6px solid black. +Your mixin should have an `@else if` statement to check if `$val` is `heavy`, and to set the `border` to `6px solid black`. ```js assert( @@ -87,7 +87,7 @@ assert( ); ``` -Your mixin should have an `@else` statement to set the `border` to none. +Your mixin should have an `@else` statement to set the `border` to `none`. ```js assert(code.match(/@else\s*?{\s*?border\s*?:\s*?none\s*?;\s*?}/gi)); diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart.md index 4add1bf6b4..33794d33d4 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-bar-chart.md @@ -20,17 +20,17 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T **User Story #3:** My chart should have a `g` element y-axis with a corresponding `id="y-axis"`. -**User Story #4:** Both axes should contain multiple tick labels, each with the corresponding `class="tick"`. +**User Story #4:** Both axes should contain multiple tick labels, each with a corresponding `class="tick"`. **User Story #5:** My chart should have a `rect` element for each data point with a corresponding `class="bar"` displaying the data. -**User Story #6:** Each bar should have the properties `data-date` and `data-gdp` containing date and GDP values. +**User Story #6:** Each bar should have the properties `data-date` and `data-gdp` containing `date` and `GDP` values. **User Story #7:** The bar elements' `data-date` properties should match the order of the provided data. **User Story #8:** The bar elements' `data-gdp` properties should match the order of the provided data. -**User Story #9:** Each bar element's height should accurately represent the data's corresponding GDP. +**User Story #9:** Each bar element's height should accurately represent the data's corresponding `GDP`. **User Story #10:** The `data-date` attribute and its corresponding bar element should align with the corresponding value on the x-axis. @@ -42,7 +42,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T Here is the dataset you will need to complete this project: `https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json` -You can build your project by forking [this CodePen pen](https://codepen.io/freeCodeCamp/pen/MJjpwO). Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`. +You can build your project by using this CodePen template and clicking `Save` to create your own pen. Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`. Once you're done, submit the URL to your working project with all its tests passing. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md index 5d4c6cf771..8367df6732 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-choropleth-map.md @@ -22,11 +22,11 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. R **User Story #4:** There should be at least 4 different fill colors used for the counties. -**User Story #5:** My counties should each have `data-fips` and `data-education` properties containing their corresponding fips and education values. +**User Story #5:** My counties should each have `data-fips` and `data-education` properties containing their corresponding `fips` and `education` values. **User Story #6:** My choropleth should have a county for each provided data point. -**User Story #7:** The counties should have data-fips and data-education values that match the sample data. +**User Story #7:** The counties should have `data-fips` and `data-education` values that match the sample data. **User Story #8:** My choropleth should have a legend with a corresponding `id="legend"`. @@ -41,7 +41,7 @@ Here are the datasets you will need to complete this project: - **US Education Data:**`https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/for_user_education.json` - **US County Data:**`https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json` -You can build your project by forking [this CodePen pen](https://codepen.io/freeCodeCamp/pen/MJjpwO). Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` +You can build your project by using this CodePen template and clicking `Save` to create your own pen. Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` Once you're done, submit the URL to your working project with all its tests passing. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-heat-map.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-heat-map.md index 4ca060d07f..6a8ea226fb 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-heat-map.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-heat-map.md @@ -26,7 +26,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. R **User Story #6:** There should be at least 4 different fill colors used for the cells. -**User Story #7:** Each cell will have the properties `data-month`, `data-year`, `data-temp` containing their corresponding month, year, and temperature values. +**User Story #7:** Each cell will have the properties `data-month`, `data-year`, `data-temp` containing their corresponding `month`, `year`, and `temperature` values. **User Story #8:** The `data-month`, `data-year` of each cell should be within the range of the data. @@ -50,7 +50,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. R Here is the dataset you will need to complete this project: `https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/global-temperature.json` -You can build your project by forking [this CodePen pen](https://codepen.io/freeCodeCamp/pen/MJjpwO). Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` +You can build your project by using this CodePen template and clicking `Save` to create your own pen. Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` Once you're done, submit the URL to your working project with all its tests passing. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph.md index 2c07a9b5aa..03d20ab5d2 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-scatterplot-graph.md @@ -22,9 +22,9 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T **User Story #4:** I can see dots, that each have a class of `dot`, which represent the data being plotted. -**User Story #5:** Each dot should have the properties `data-xvalue` and `data-yvalue` containing their corresponding x and y values. +**User Story #5:** Each dot should have the properties `data-xvalue` and `data-yvalue` containing their corresponding `x` and `y` values. -**User Story #6:** The `data-xvalue` and `data-yvalue` of each dot should be within the range of the actual data and in the correct data format. For `data-xvalue`, integers (full years) or Date objects are acceptable for test evaluation. For `data-yvalue` (minutes), use Date objects. +**User Story #6:** The `data-xvalue` and `data-yvalue` of each dot should be within the range of the actual data and in the correct data format. For `data-xvalue`, integers (full years) or `Date` objects are acceptable for test evaluation. For `data-yvalue` (minutes), use `Date` objects. **User Story #7:** The `data-xvalue` and its corresponding dot should align with the corresponding point/value on the x-axis. @@ -46,7 +46,7 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T Here is the dataset you will need to complete this project: `https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/cyclist-data.json` -You can build your project by forking [this CodePen pen](https://codepen.io/freeCodeCamp/pen/MJjpwO). Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` +You can build your project by using this CodePen template and clicking `Save` to create your own pen. Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` Once you're done, submit the URL to your working project with all its tests passing. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md index 85a5139f97..3f5196b244 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-projects/visualize-data-with-a-treemap-diagram.md @@ -22,9 +22,9 @@ You can use HTML, JavaScript, CSS, and the D3 svg-based visualization library. T **User Story #4:** There should be at least 2 different fill colors used for the tiles. -**User Story #5:** Each tile should have the properties `data-name`, `data-category`, and `data-value` containing their corresponding name, category, and value. +**User Story #5:** Each tile should have the properties `data-name`, `data-category`, and `data-value` containing their corresponding `name`, `category`, and `value`. -**User Story #6:** The area of each tile should correspond to the data-value amount: tiles with a larger data-value should have a bigger area. +**User Story #6:** The area of each tile should correspond to the `data-value` amount: tiles with a larger `data-value` should have a bigger area. **User Story #7:** My tree map should have a legend with corresponding `id="legend"`. @@ -42,7 +42,7 @@ For this project you can use any of the following datasets: - **Movie Sales:** `https://cdn.freecodecamp.org/testable-projects-fcc/data/tree_map/movie-data.json` - **Video Game Sales:** `https://cdn.freecodecamp.org/testable-projects-fcc/data/tree_map/video-game-sales-data.json` -You can build your project by forking [this CodePen pen](https://codepen.io/freeCodeCamp/pen/MJjpwO). Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` +You can build your project by using this CodePen template and clicking `Save` to create your own pen. Or you can use this CDN link to run the tests in any environment you like: `https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js` Once you're done, submit the URL to your working project with all its tests passing. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md index 85a34c34a1..beb4f34992 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-hover-effect-to-a-d3-element.md @@ -21,7 +21,7 @@ Use the `attr()` method to add a class of `bar` to all the `rect` elements. This Your `rect` elements should have a class of `bar`. ```js -assert($('rect').attr('class') == 'bar'); +assert($('rect').attr('class').trim().split(/\s+/g).includes('bar')); ``` # --seed-- diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md index 5cbd990ad5..869ca675f9 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-a-tooltip-to-a-d3-element.md @@ -24,55 +24,55 @@ Your code should have 9 `title` elements. assert($('title').length == 9); ``` -The first `title` element should have tooltip text of 12. +The first `title` element should have tooltip text of `12`. ```js assert($('title').eq(0).text() == '12'); ``` -The second `title` element should have tooltip text of 31. +The second `title` element should have tooltip text of `31`. ```js assert($('title').eq(1).text() == '31'); ``` -The third `title` element should have tooltip text of 22. +The third `title` element should have tooltip text of `22`. ```js assert($('title').eq(2).text() == '22'); ``` -The fourth `title` element should have tooltip text of 17. +The fourth `title` element should have tooltip text of `17`. ```js assert($('title').eq(3).text() == '17'); ``` -The fifth `title` element should have tooltip text of 25. +The fifth `title` element should have tooltip text of `25`. ```js assert($('title').eq(4).text() == '25'); ``` -The sixth `title` element should have tooltip text of 18. +The sixth `title` element should have tooltip text of `18`. ```js assert($('title').eq(5).text() == '18'); ``` -The seventh `title` element should have tooltip text of 29. +The seventh `title` element should have tooltip text of `29`. ```js assert($('title').eq(6).text() == '29'); ``` -The eighth `title` element should have tooltip text of 14. +The eighth `title` element should have tooltip text of `14`. ```js assert($('title').eq(7).text() == '14'); ``` -The ninth `title` element should have tooltip text of 9. +The ninth `title` element should have tooltip text of `9`. ```js assert($('title').eq(8).text() == '9'); diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements.md index 7ad073a32a..f8ad572913 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements.md @@ -18,7 +18,7 @@ All three attributes can use a callback function to set their values dynamically # --instructions-- -Add `cx`, `cy`, and `r` attributes to the `circle` elements. The `cx` value should be the first number in the array for each item in `dataset`. The `cy` value should be based off the second number in the array, but make sure to show the chart right-side-up and not inverted. The `r` value should be 5 for all circles. +Add `cx`, `cy`, and `r` attributes to the `circle` elements. The `cx` value should be the first number in the array for each item in `dataset`. The `cy` value should be based off the second number in the array, but make sure to show the chart right-side-up and not inverted. The `r` value should be `5` for all circles. # --hints-- @@ -28,7 +28,7 @@ Your code should have 10 `circle` elements. assert($('circle').length == 10); ``` -The first `circle` element should have a `cx` value of 34, a `cy` value of 422, and an `r` value of 5. +The first `circle` element should have a `cx` value of `34`, a `cy` value of `422`, and an `r` value of `5`. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -The second `circle` element should have a `cx` value of 109, a `cy` value of 220, and an `r` value of 5. +The second `circle` element should have a `cx` value of `109`, a `cy` value of `220`, and an `r` value of `5`. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -The third `circle` element should have a `cx` value of 310, a `cy` value of 380, and an `r` value of 5. +The third `circle` element should have a `cx` value of `310`, a `cy` value of `380`, and an `r` value of `5`. ```js assert( @@ -58,7 +58,7 @@ assert( ); ``` -The fourth `circle` element should have a `cx` value of 79, a `cy` value of 89, and an `r` value of 5. +The fourth `circle` element should have a `cx` value of `79`, a `cy` value of `89`, and an `r` value of `5`. ```js assert( @@ -68,7 +68,7 @@ assert( ); ``` -The fifth `circle` element should have a `cx` value of 420, a `cy` value of 280, and an `r` value of 5. +The fifth `circle` element should have a `cx` value of `420`, a `cy` value of `280`, and an `r` value of `5`. ```js assert( @@ -78,7 +78,7 @@ assert( ); ``` -The sixth `circle` element should have a `cx` value of 233, a `cy` value of 355, and an `r` value of 5. +The sixth `circle` element should have a `cx` value of `233`, a `cy` value of `355`, and an `r` value of `5`. ```js assert( @@ -88,7 +88,7 @@ assert( ); ``` -The seventh `circle` element should have a `cx` value of 333, a `cy` value of 404, and an `r` value of 5. +The seventh `circle` element should have a `cx` value of `333`, a `cy` value of `404`, and an `r` value of `5`. ```js assert( @@ -98,7 +98,7 @@ assert( ); ``` -The eighth `circle` element should have a `cx` value of 222, a `cy` value of 167, and an `r` value of 5. +The eighth `circle` element should have a `cx` value of `222`, a `cy` value of `167`, and an `r` value of `5`. ```js assert( @@ -108,7 +108,7 @@ assert( ); ``` -The ninth `circle` element should have a `cx` value of 78, a `cy` value of 180, and an `r` value of 5. +The ninth `circle` element should have a `cx` value of `78`, a `cy` value of `180`, and an `r` value of `5`. ```js assert( @@ -118,7 +118,7 @@ assert( ); ``` -The tenth `circle` element should have a `cx` value of 21, a `cy` value of 377, and an `r` value of 5. +The tenth `circle` element should have a `cx` value of `21`, a `cy` value of `377`, and an `r` value of `5`. ```js assert( diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md index f4d9f3fc4b..a1f0bd70dd 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.md @@ -26,11 +26,11 @@ svg.append("g") .call(xAxis); ``` -The above code places the x-axis at the bottom of the SVG canvas. Then it's passed as an argument to the `call()` method. The y-axis works in the same way, except the `translate` argument is in the form (x, 0). Because `translate` is a string in the `attr()` method above, you can use concatenation to include variable values for its arguments. +The above code places the x-axis at the bottom of the SVG canvas. Then it's passed as an argument to the `call()` method. The y-axis works in the same way, except the `translate` argument is in the form `(x, 0)`. Because `translate` is a string in the `attr()` method above, you can use concatenation to include variable values for its arguments. # --instructions-- -The scatter plot now has an x-axis. Create a y-axis in a variable named `yAxis` using the `axisLeft()` method. Then render the axis using a `g` element. Make sure to use a `transform` attribute to translate the axis by the amount of padding units right, and 0 units down. Remember to `call()` the axis. +The scatter plot now has an x-axis. Create a y-axis in a variable named `yAxis` using the `axisLeft()` method. Then render the axis using a `g` element. Make sure to use a `transform` attribute to translate the axis by the amount of padding units right, and `0` units down. Remember to `call()` the axis. # --hints-- @@ -40,7 +40,7 @@ Your code should use the `axisLeft()` method with `yScale` passed as the argumen assert(code.match(/\.axisLeft\(yScale\)/g)); ``` -The y-axis `g` element should have a `transform` attribute to translate the axis by (60, 0). +The y-axis `g` element should have a `transform` attribute to translate the axis by `(60, 0)`. ```js assert( diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.md index a097263ca4..a2911cf178 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.md @@ -10,11 +10,13 @@ dashedName: add-classes-with-d3 Using a lot of inline styles on HTML elements gets hard to manage, even for smaller apps. It's easier to add a class to elements and style that class one time using CSS rules. D3 has the `attr()` method to add any HTML attribute to an element, including a class name. -The `attr()` method works the same way that `style()` does. It takes comma-separated values, and can use a callback function. Here's an example to add a class of "container" to a selection: +The `attr()` method works the same way that `style()` does. It takes comma-separated values, and can use a callback function. Here's an example to add a class of `container` to a selection: -`selection.attr("class", "container");` +```js +selection.attr("class", "container"); +``` -Note that the "class" parameter will remain the same whenever you need to add a class and only the "container" parameter will change. +Note that the `class` parameter will remain the same whenever you need to add a class and only the `container` parameter will change. # --instructions-- @@ -25,7 +27,7 @@ Add the `attr()` method to the code in the editor and put a class of `bar` on th Your `div` elements should have a class of `bar`. ```js -assert($('div').attr('class') == 'bar'); +assert($('div').attr('class').trim().split(/\s+/g).includes('bar')); ``` Your code should use the `attr()` method. diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-document-elements-with-d3.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-document-elements-with-d3.md index a1107dbf11..ea44782e9c 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-document-elements-with-d3.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-document-elements-with-d3.md @@ -12,9 +12,11 @@ D3 has several methods that let you add and change elements in your document. The `select()` method selects one element from the document. It takes an argument for the name of the element you want and returns an HTML node for the first element in the document that matches the name. Here's an example: -`const anchor = d3.select("a");` +```js +const anchor = d3.select("a"); +``` -The above example finds the first anchor tag on the page and saves an HTML node for it in the variable `anchor`. You can use the selection with other methods. The "d3" part of the example is a reference to the D3 object, which is how you access D3 methods. +The above example finds the first anchor tag on the page and saves an HTML node for it in the variable `anchor`. You can use the selection with other methods. The `d3` part of the example is a reference to the D3 object, which is how you access D3 methods. Two other useful methods are `append()` and `text()`. @@ -34,7 +36,7 @@ D3 allows you to chain several methods together with periods to perform a number # --instructions-- -Use the `select` method to select the `body` tag in the document. Then `append` an `h1` tag to it, and add the text "Learning D3" into the `h1` element. +Use the `select` method to select the `body` tag in the document. Then `append` an `h1` tag to it, and add the text `Learning D3` into the `h1` element. # --hints-- @@ -44,7 +46,7 @@ The `body` should have one `h1` element. assert($('body').children('h1').length == 1); ``` -The `h1` element should have the text "Learning D3" in it. +The `h1` element should have the text `Learning D3` in it. ```js assert($('h1').text() == 'Learning D3'); diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-inline-styling-to-elements.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-inline-styling-to-elements.md index 88c1b74f17..9c538755d7 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-inline-styling-to-elements.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-inline-styling-to-elements.md @@ -12,7 +12,9 @@ D3 lets you add inline CSS styles on dynamic elements with the `style()` method. The `style()` method takes a comma-separated key-value pair as an argument. Here's an example to set the selection's text color to blue: -`selection.style("color","blue");` +```js +selection.style("color","blue"); +``` # --instructions-- @@ -20,7 +22,7 @@ Add the `style()` method to the code in the editor to make all the displayed tex # --hints-- -Your `h2` elements should have a `font-family` of verdana. +Your `h2` elements should have a `font-family` of `verdana`. ```js assert($('h2').css('font-family') == 'verdana'); diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-d3-elements.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-d3-elements.md index 060f4e59c1..d0da292c76 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-d3-elements.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-d3-elements.md @@ -18,60 +18,59 @@ D3 gives you a high level of control over how you label your bars. The code in the editor already binds the data to each new `text` element. First, append `text` nodes to the `svg`. Next, add attributes for the `x` and `y` coordinates. They should be calculated the same way as the `rect` ones, except the `y` value for the `text` should make the label sit 3 units higher than the bar. Finally, use the D3 `text()` method to set the label equal to the data point value. -**Note** -For the label to sit higher than the bar, decide if the `y` value for the `text` should be 3 greater or 3 less than the `y` value for the bar. +**Note:** For the label to sit higher than the bar, decide if the `y` value for the `text` should be 3 greater or 3 less than the `y` value for the bar. # --hints-- -The first `text` element should have a label of 12 and a `y` value of 61. +The first `text` element should have a label of `12` and a `y` value of `61`. ```js assert($('text').eq(0).text() == '12' && $('text').eq(0).attr('y') == '61'); ``` -The second `text` element should have a label of 31 and a `y` value of 4. +The second `text` element should have a label of `31` and a `y` value of `4`. ```js assert($('text').eq(1).text() == '31' && $('text').eq(1).attr('y') == '4'); ``` -The third `text` element should have a label of 22 and a `y` value of 31. +The third `text` element should have a label of `22` and a `y` value of `31`. ```js assert($('text').eq(2).text() == '22' && $('text').eq(2).attr('y') == '31'); ``` -The fourth `text` element should have a label of 17 and a `y` value of 46. +The fourth `text` element should have a label of `17` and a `y` value of `46`. ```js assert($('text').eq(3).text() == '17' && $('text').eq(3).attr('y') == '46'); ``` -The fifth `text` element should have a label of 25 and a `y` value of 22. +The fifth `text` element should have a label of `25` and a `y` value of `22`. ```js assert($('text').eq(4).text() == '25' && $('text').eq(4).attr('y') == '22'); ``` -The sixth `text` element should have a label of 18 and a `y` value of 43. +The sixth `text` element should have a label of `18` and a `y` value of `43`. ```js assert($('text').eq(5).text() == '18' && $('text').eq(5).attr('y') == '43'); ``` -The seventh `text` element should have a label of 29 and a `y` value of 10. +The seventh `text` element should have a label of `29` and a `y` value of `10`. ```js assert($('text').eq(6).text() == '29' && $('text').eq(6).attr('y') == '10'); ``` -The eighth `text` element should have a label of 14 and a `y` value of 55. +The eighth `text` element should have a label of `14` and a `y` value of `55`. ```js assert($('text').eq(7).text() == '14' && $('text').eq(7).attr('y') == '55'); ``` -The ninth `text` element should have a label of 9 and a `y` value of 70. +The ninth `text` element should have a label of `9` and a `y` value of `70`. ```js assert($('text').eq(8).text() == '9' && $('text').eq(8).attr('y') == '70'); diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md index 8697e5117e..a2cd64c0a4 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/add-labels-to-scatter-plot-circles.md @@ -16,7 +16,7 @@ The `text` nodes need `x` and `y` attributes to position it on the SVG canvas. I # --instructions-- -Label each point on the scatter plot using the `text` elements. The text of the label should be the two values separated by a comma and a space. For example, the label for the first point is "34, 78". Set the `x` attribute so it's 5 units more than the value you used for the `cx` attribute on the `circle`. Set the `y` attribute the same way that's used for the `cy` value on the `circle`. +Label each point on the scatter plot using the `text` elements. The text of the label should be the two values separated by a comma and a space. For example, the label for the first point is `34, 78`. Set the `x` attribute so it's `5` units more than the value you used for the `cx` attribute on the `circle`. Set the `y` attribute the same way that's used for the `cy` value on the `circle`. # --hints-- @@ -26,7 +26,7 @@ Your code should have 10 `text` elements. assert($('text').length == 10); ``` -The first label should have text of "34, 78", an `x` value of 39, and a `y` value of 422. +The first label should have text of `34, 78`, an `x` value of `39`, and a `y` value of `422`. ```js assert( @@ -36,7 +36,7 @@ assert( ); ``` -The second label should have text of "109, 280", an `x` value of 114, and a `y` value of 220. +The second label should have text of `109, 280`, an `x` value of `114`, and a `y` value of `220`. ```js assert( @@ -46,7 +46,7 @@ assert( ); ``` -The third label should have text of "310, 120", an `x` value of 315, and a `y` value of 380. +The third label should have text of `310, 120`, an `x` value of `315`, and a `y` value of `380`. ```js assert( @@ -56,7 +56,7 @@ assert( ); ``` -The fourth label should have text of "79, 411", an `x` value of 84, and a `y` value of 89. +The fourth label should have text of `79, 411`, an `x` value of `84`, and a `y` value of `89`. ```js assert( @@ -66,7 +66,7 @@ assert( ); ``` -The fifth label should have text of "420, 220", an `x` value of 425, and a `y` value of 280. +The fifth label should have text of `420, 220`, an `x` value of `425`, and a `y` value of `280`. ```js assert( @@ -76,7 +76,7 @@ assert( ); ``` -The sixth label should have text of "233, 145", an `x` value of 238, and a `y` value of 355. +The sixth label should have text of `233, 145`, an `x` value of `238`, and a `y` value of `355`. ```js assert( @@ -86,7 +86,7 @@ assert( ); ``` -The seventh label should have text of "333, 96", an `x` value of 338, and a `y` value of 404. +The seventh label should have text of `333, 96`, an `x` value of `338`, and a `y` value of `404`. ```js assert( @@ -96,7 +96,7 @@ assert( ); ``` -The eighth label should have text of "222, 333", an `x` value of 227, and a `y` value of 167. +The eighth label should have text of `222, 333`, an `x` value of `227`, and a `y` value of `167`. ```js assert( @@ -106,7 +106,7 @@ assert( ); ``` -The ninth label should have text of "78, 320", an `x` value of 83, and a `y` value of 180. +The ninth label should have text of `78, 320`, an `x` value of `83`, and a `y` value of `180`. ```js assert( @@ -116,7 +116,7 @@ assert( ); ``` -The tenth label should have text of "21, 123", an `x` value of 26, and a `y` value of 377. +The tenth label should have text of `21, 123`, an `x` value of `26`, and a `y` value of `377`. ```js assert( diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-styles-based-on-data.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-styles-based-on-data.md index 348828f163..1ed6ae7d5e 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-styles-based-on-data.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-styles-based-on-data.md @@ -14,7 +14,7 @@ For example, you may want to color a data point blue if it has a value less than ```js selection.style("color", (d) => { - /* Logic that returns the color based on a condition */ + }); ``` @@ -22,10 +22,9 @@ The `style()` method is not limited to setting the `color` - it can be used with # --instructions-- -Add the `style()` method to the code in the editor to set the `color` of the `h2` elements conditionally. Write the callback function so if the data value is less than 20, it returns "red", otherwise it returns "green". +Add the `style()` method to the code in the editor to set the `color` of the `h2` elements conditionally. Write the callback function so if the data value is less than 20, it returns red, otherwise it returns green. -**Note** -You can use if-else logic, or the ternary operator. +**Note:** You can use if-else logic, or the ternary operator. # --hints-- diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-color-of-an-svg-element.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-color-of-an-svg-element.md index d49e0a571f..4e0d47f93c 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-color-of-an-svg-element.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-color-of-an-svg-element.md @@ -14,7 +14,7 @@ In SVG, a `rect` shape is colored with the `fill` attribute. It supports hex cod # --instructions-- -Add an `attr()` method to set the "fill" of all the bars to the color "navy". +Add an `attr()` method to set the `fill` of all the bars to the color navy. # --hints-- diff --git a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md index 00ce9fa19f..46b6e2613d 100644 --- a/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md +++ b/curriculum/challenges/espanol/04-data-visualization/data-visualization-with-d3/change-the-presentation-of-a-bar-chart.md @@ -16,14 +16,13 @@ The last challenge created a bar chart, but there are a couple of formatting cha # --instructions-- -First, add a `margin` of 2px to the `bar` class in the `style` tag. Next, change the callback function in the `style()` method so it returns a value 10 times the original data value (plus the "px"). +First, add a `margin` of `2px` to the `bar` class in the `style` tag. Next, change the callback function in the `style()` method so it returns a value `10` times the original data value (plus the `px`). -**Note** -Multiplying each data point by the *same* constant only alters the scale. It's like zooming in, and it doesn't change the meaning of the underlying data. +**Note:** Multiplying each data point by the *same* constant only alters the scale. It's like zooming in, and it doesn't change the meaning of the underlying data. # --hints-- -The first `div` should have a `height` of 120 pixels and a `margin` of 2 pixels. +The first `div` should have a `height` of `120` pixels and a `margin` of `2` pixels. ```js assert( @@ -32,7 +31,7 @@ assert( ); ``` -The second `div` should have a `height` of 310 pixels and a `margin` of 2 pixels. +The second `div` should have a `height` of `310` pixels and a `margin` of `2` pixels. ```js assert( @@ -41,7 +40,7 @@ assert( ); ``` -The third `div` should have a `height` of 220 pixels and a `margin` of 2 pixels. +The third `div` should have a `height` of `220` pixels and a `margin` of `2` pixels. ```js assert( @@ -50,7 +49,7 @@ assert( ); ``` -The fourth `div` should have a `height` of 170 pixels and a `margin` of 2 pixels. +The fourth `div` should have a `height` of `170` pixels and a `margin` of `2` pixels. ```js assert( @@ -59,7 +58,7 @@ assert( ); ``` -The fifth `div` should have a `height` of 250 pixels and a `margin` of 2 pixels. +The fifth `div` should have a `height` of `250` pixels and a `margin` of `2` pixels. ```js assert( @@ -68,7 +67,7 @@ assert( ); ``` -The sixth `div` should have a `height` of 180 pixels and a `margin` of 2 pixels. +The sixth `div` should have a `height` of `180` pixels and a `margin` of `2` pixels. ```js assert( @@ -77,7 +76,7 @@ assert( ); ``` -The seventh `div` should have a `height` of 290 pixels and a `margin` of 2 pixels. +The seventh `div` should have a `height` of `290` pixels and a `margin` of `2` pixels. ```js assert( @@ -86,7 +85,7 @@ assert( ); ``` -The eighth `div` should have a `height` of 140 pixels and a `margin` of 2 pixels. +The eighth `div` should have a `height` of `140` pixels and a `margin` of `2` pixels. ```js assert( @@ -95,7 +94,7 @@ assert( ); ``` -The ninth `div` should have a `height` of 90 pixels and a `margin` of 2 pixels. +The ninth `div` should have a `height` of `90` pixels and a `margin` of `2` pixels. ```js assert( @@ -113,10 +112,10 @@ assert( .bar { width: 25px; height: 100px; - /* Only change code below this line */ + /* Add your code below this line */ - /* Only change code above this line */ + /* Add your code above this line */ display: inline-block; background-color: blue; } @@ -130,7 +129,7 @@ assert( .enter() .append("div") .attr("class", "bar") - .style("height", (d) => (d + "px")) + .style("height", (d) => (d + "px")) // Change this line