adding component to instantiated gameobject

i want to add script component to intantiated gameobject, but the problem is the script in c# and the script i want to add is javascript and cannot added

here is the code

IEnumerator OnMouseUp(){
		
		yield return new WaitForSeconds(0.35f);
		
		if(cube){
			Vector3 mousePos = Input.mousePosition;
			mousePos.z = 20;
	        Vector3 objectPos = Camera.current.ScreenToWorldPoint(mousePos);

			GameObject newInstance1 = Instantiate(Cube, objectPos, Quaternion.identity) as GameObject;
			newInstance1.AddComponent<ObjectInfo>(); //this is javascript code.

when i add objectInfo script to this code it show this error
error CS0246: The type or namespace name `ObjectInfo’ could not be found. Are you missing a using directive or an assembly reference?

This is a problem of script visibility.
Unity allows to use C#, Js and Boo freely, to some extend…

C# and Js compilers are different it means what is written in one language is not visible to the other language. Once everything is compiled to IL then they can interact but during compilation they can’t so it won’t work(not so clear I guess…). But you can fix that by placing the script to be looked at (your js script) inside the Standard Asset folder.

The reason is because while compiling, Unity first looks into that folder and compiles everything in, then it goes for other folders. Now the C# script is in IL, the js script can look for it and find it and then use it.