undoing the process of parenting an object

I made the transform of object A a child of object B transform, so that I can use object B to move object A. As shown below

objectA.transform.parent = objectB.transform;

Now, I want to undo the process, that is, to allow objectA to be able to move on its own.



objectA.transform.parent = null;