Replace the Word Explainer

Aim of the puzzle: Use Apps Script to edit the text of a document from Docs.

Walk through of the solution: Apps Script has custom code functions that connect to Docs. One example is .replaceText(), which replaces every occurance of a word in a document from Docs with another word.

.replaceText() takes 2 arguments: a string to replace and a new string to put in its place. Every occurrence of the string to replace is replaced with the new string.

To complete the puzzle, change the 2nd argument inside the parentheses of .replaceText() from 'snakes' to another string.

Sample code solution:

let id = '1VFYFgTvngQzMgm-x1Kyejv1fiTWVTahG9G8x2a76sAM';
let doc = DocumentApp.openById(id);

let originalText = doc.getText();

doc.replaceText('you', '!!');

let newText = doc.getText();

JavaScript concepts: Variables, Strings

Apps Script concepts: DocumentApp, openById(), .replaceText()