How to know if the code is Javascript or some derivation of it?

Asked

Viewed 47 times

0

I have a code that follows the structure below. It is in a file ". js". The doubts is:

Is it pure javascript code or some derivation of it? If not, how do I know?

const uuidv1 = require('uuid/v1');
const { Before } = require('cucumber');

// Synchronous
Before(function () {
  this.callSid = uuidv1();
  this.audioOrder = 0;
});
  • 1

    Apparently this seems to be Cucumber, a framework or tool as well as others (Selenium, Karma, Mocha, etc...) which are briefly used to perform functionality tests in code.

  • But this structure where it imports 'Cucumber' and uses the Before method I follow the standard Javascript encoding?

1 answer

3


You should define the language by syntax, lints and file format, because what you will define is your application, and how it will be compiled. if it is in js, even with use of lints to correct syntax errors differences between es5 or es6 and etc.

as it is using const, importing with require this Before module, and fact that it is using es6(js)

excellent article on es6

example of checks:

(fun [x] (+ (* 2 x)) qual linguagem ?

you can only know the language of this code if the developer has knowledge about or if your ide has some form of verification.

let lista:Array<Produtos> = [...] qual linguagem ?

or

 List<Produto> produtos  = this.produtosService.obterTodos();

I believe the easiest way is to use a vscode or sublime style editor that has several tools for this type of checking.

  • Very good explanation, +1.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.