How to Pass c# int variable to javascript

Hi
I have a C# script that reads serial data from arduino and i want to pass that data “distance” to javascript. How can i do it?
here´s the c# code:

using UnityEngine;
using System.Collections;
using System.IO.Ports;

public class ArduinoConnect : MonoBehaviour {
    SerialPort str= new SerialPort("COM7", 9600);
	    
void Start () {
       str.Open();
       str.ReadTimeout = 1;
 
    }

    void Update () {
 
       if (str.IsOpen)   {
 
   try {

  	int distance = int.Parse(str.ReadLine());
			Debug.Log("Distance: "+ distance.ToString());
			guiText.text= distance.ToString();

Please help

  1. The Javascript would have to be in either Standard Assets or Plugins (or a sub folder of one of those). In this case you can just GetComponent for the script and call a function or set the variable.

  2. Use SendMessage and pass a parameter to call a function on the Javascript

    SendMessage(“SetTheIntValue”, someIntValue);

    function SetTheIntValue(value : int)
    {
    }