Java script viewer tool



import React, { useState } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism"; import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; import { Card, CardContent } from "@/components/ui/card"; import { motion } from "framer-motion"; const JSViewerTool = () => { const [code, setCode] = useState("console.log('Hello, world!');"); const [output, setOutput] = useState(""); const [activeTab, setActiveTab] = useState("code"); const runCode = () => { try { const capturedLogs = []; const originalLog = console.log; console.log = (...args) => capturedLogs.push(args.join(" ")); // eslint-disable-next-line no-eval eval(code); console.log = originalLog; setOutput(capturedLogs.join("\n")); } catch (error) { setOutput(Error: ${error.message}); } }; return (

JavaScript Viewer Tool

Code Output