get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
`const ADD_NOTE = 'ADD_NOTE';
const notesReducer = (state = 'Initial State', action) => {
switch(action.type) {
// change code below this line
case ADD_NOTE:
return {text:action.text}
// change code above this line
default:
return state;
}
};
const addNoteText = (note) => {
// change code below this line
return {type: ADD_NOTE,
text: note}
// change code above this line
};
const store = Redux.createStore(notesReducer);
console.log(store.getState());
store.dispatch(addNoteText('Hello!'));
console.log(store.getState());`
return action.text
type
and text
it's easier to stick these into an object than to pass 2 different values
reduce()
function intersection(arrays){
return arrays[0].filter(e => arrays[1].includes(e) && arrays[2].includes(e));
}
acc.length
was undefined
function intersection(arrays){
var arr = arrays.reduce(function(acc, nxt){
console.log(acc, nxt);
console.log("---");
});
return arr;
}
acc
and nxt
are - [ 5, 10, 15, 20 ] [ 15, 88, 1, 5, 7 ]
acc
is undefined
nxt
is [ 1, 10, 15, 5, 20 ]
simpleguy747 sends brownie points to @enecatalin and @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 457 | @enecatalin |http://www.freecodecamp.org/enecatalin
:star2: 2229 | @ndburrus |http://www.freecodecamp.org/ndburrus
So I tried:
import ReactDOM from 'react-dom';
and received the another error:
require is not defined