← Back to Debugger domain

Debugger.setVariableValue

Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.

Domain: Debugger stable

Parameters

NameTypeDescription
scopeNumberinteger0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
variableNamestringVariable name.
newValueRuntime.CallArgumentNew variable value.
callFrameIdCallFrameIdId of callframe that holds variable.

Example Request

{
  "id": 1,
  "method": "Debugger.setVariableValue",
  "params": {
    "scopeNumber": 1,
    "variableName": "variableName-value",
    "newValue": "newValue-value",
    "callFrameId": "0"
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Debugger.setVariableValue', {"scopeNumber": 1, "variableName": "variableName-value", "newValue": "newValue-value", "callFrameId": "0"});
console.log(result);