newID is not update when I assign newID = record.id

var myCat ={};
myCat.Name = “BOB”;
var newID=-1;
//A record is created in the table, all information is stored in the record.
createRecord(“Cats”, myCat, function(record) {
console.log(“Cat BOB is created with ID”+record.id);
newID = (record.id);
});

console.log("the new ID is : "+newID);
updateRecord(“Cats”, {id:newID, Name:‘Bob’, MaximumLifeSpan: 12}, function(record, success) {

});

In accordance with the College Board’s guidelines for AP CS Principles Exam, we limit the debugging assistance we provide from March through the submission deadline for the Create Task.

From page 14 of the CB’s student handouts:

“you may not seek assistance in writing, revising, amending, or correcting your work, including debugging the program, writing or designing functionality in the program, testing the program, or making revisions to the program, from anyone other than your collaborative partner(s). "

Please verify this project is not part of a student’s Create Task for AP CS Principles.

If it is, we can only verify whether there is a technical issue with the platform causing the bug. If it is not, we are happy to help locate the bug and provide guidance on fixing it!

We’re happy to help once you’ve verified that this project is not part of a student’s Create task submission.

This is not student’s PT at all. I figure it out already. but I have another question. in data table in , there are columns that has multiple words column. When I use createRecord, the columns name are not legitimate due to the spaces in between. how can I do update record with a specific column?

Please share a link to the project.

You can write the column name as a string. Example:

createRecord("Cats", {id:1, Name:"Bob", "Maximum Life Span": 12});