Web APIs

Response.text()

Try the free JavaScript compiler

Consume the body and decode it as UTF-8 text. Reading the same consumed body again fails; clone first if independent reads are required. Example console output: ready true.

Formal Syntax & Structure

javascript syntaxjavascript
response.text()

Return Value

Promise<string>

Decoded text.

Working Example

Example Snippetjavascript
(async () => {const response=new Response("ready"); console.log(await response.text(),response.bodyUsed);})()
JavaScript Reference