make object follow other without parenting

Lets see how should i say this… I have Object1 and Object2 and I want Object2 to follow Object1 but not on the z- axis. I dont want to accomplish this by making Object2 a child of Object2. Im still learning how to code. I need to somehow have a script that reads the x and y location of Object1 and make Object2 go there. I think this will require 2 scripts but im still trying to wrap my head around calling another script inside a script.

oh and im much more familiar with javascript than c# so if i could get some help in javascript that would be preferable.

am not familiar with javascript, but the script should be something like this (if added to the one that follows):
in awake()
other = GameObject.find(“followthis”);

in update()
transform.position = other.transform.position;

if you want to ignore z … you can try this

transform.position.x = other.transform.position.x;
transform.position.y = other.transform.position.y;

there was a series of articles I found handy when it came to the theory behind steering behaviors, this one is the one on “follow”

what Do you mean by
OTHER