Time Remaining3:00
easyHallucinated APIsNode.js

The confident method

A developer asked an AI assistant to deep-clone a settings object before mutating it inside a reducer. The suggested code runs the import fine but throws the moment the function is actually called.

settings.js
const _ = require('lodash');

function updateSettings(settings, patch) {
  const draft = _.deepClone(settings);
  Object.assign(draft, patch);
  return draft;
}

module.exports = { updateSettings };

What happens when updateSettings runs?

TypeError: _.deepClone is not a function — Lodash's deep-clone method is named cloneDeep, not deepClone.
The settings object clones correctly but the patch is applied in the wrong order.
Object.assign throws because draft is undefined at that point.
The function works correctly; there is no bug here.