Generation

generate functionThu, 15 Jun 2023

function compareStatements(people) { You have put each of the suspects and their information into an object as follows: const person1 = { name: 'Alice', statements: [ 'I was in the location', 'Bob was in the place', 'Charlie was not in the spot, 'Daisy was in the zone', 'Ethan was not in the room', ], }; Your objective is to compare the statements, and if any contradict, you want to put them into a nested array as part of a sub array, appending their name to their statement as follows: [['Alice: I was in the location', 'Bob: Alice was not in the location']] and return that array. Use the .includes() method instead of the == operator. Use if statement to add the contradicting statements to a nested array.

const person1 = { name: 'Alice', statements: [ 'I was in the location', 'Bob was in the place', 'Charlie was not in the spot', 'Daisy was in the zone', 'Ethan was not in the room', ], };

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant