JavaScript eval() Function

Evaluate/Execute JavaScript code/expressions

<!DOCTYPE html>
<html>

<body>
    <p id="demo"></p>

    <script>
        var x = 10;
        var y = 20;
        var a = eval("x * y") + "<br>";
        var b = eval("2 + 2") + "<br>";
        var c = eval("x + 17") + "<br>";

        var res = a + b + c;
        document.getElementById("demo").innerHTML = res;
    </script>

</body>

</html>

Link JavaScript eval() Function

การอ่านและเขียน TextFile

อ่านข้อความจากไฟล์ test.txt และนำมาบันทึกลงไฟล์ out.txt

using System;
using System.Collections;
using System.IO;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ipFilename = @"test.txt";
            string line;
            ArrayList arr = new ArrayList();

            using (StreamReader ipFile = new StreamReader(ipFilename, Encoding.Default, true))
            {
                while ((line = ipFile.ReadLine()) != null)
                {
                    arr.Add(line);
                    Console.WriteLine(line);
                }
            }

            string opFilename = @"out.txt";
            using (StreamWriter w = File.AppendText(opFilename))
            {
                for (int i = 0; i < arr.Count; i++)
                {
                    w.WriteLine("[{0}]  {1}", i, arr[i]);
                }
            }
        }
    }
}