A simple duplicate project in JXA

Hi there!

I have a master project that I constantly duplicate for each new contract I get. I have a background in web dev. so I would love to create it in JXA as I all ready know javascript. I just can’t get it to work because I can’t figure out where to get the “to” value in “duplicate” function. Can anyone help?

var projectTitleToDuplicate = "MasterProject";
var of = Application('OmniFocus');
of.includeStandardAdditions = true
var doc = of.defaultDocument;
var MasterProject = doc.flattenedProjects.whose({name: projectTitleToDuplicate})()[0];
//var newProject = of.displayDialog('Name the project', {defaultAnswer: ''});