Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert c to javascript

/*
C               | JS
-----------------|------------------
 int x;          | var x;
-----------------|------------------
 int xs[n];      | var xs = [];
-----------------|------------------
 printf(...)     | console.log(...)
-----------------|------------------
 int f (int x) { | function f (x) {
   ...           |   ...
   return y;     |   return y;
 }               | }
The remaining syntax from your post is almost identical in C and JS.

Press F12 in your browser (Chrome or Firefox) and have some fun with JavaScript ​in the "Console" tab, it's a good starting point :-) For example, copy paste the below code into the browser console and press ENTER.
*/

function add (a, b) {
  return a + b;
}
console.log("1 + 1 =", add(1, 1));
add(1, 2);
Comment

PREVIOUS NEXT
Code Example
Javascript :: create react native app 
Javascript :: npx create next app 
::  
Javascript ::  
:: mongo delete a key in matching documents 
::  
Javascript ::  
Javascript :: nodejs server fetch is not defined 
::  
::  
::  
::  
::  
Javascript :: check device type in javascript 
::  
:: setup ejs views directory in express 
:: mongoose connect database name 
::  
::  
:: get the domain name in javascript 
Javascript ::  
Javascript ::  
Javascript ::  
::  
::  
Javascript ::  
:: bootstrap datetimepicker onchange event 
::  
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
6+5 =