Const availible in es6?

Ok so I was trying to add this code

const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://Ax:<password>";
const client = new MongoClient(uri, { useNewUrlParser: true });
client.connect(err => {
  const collection = client.db("test").collection("devices");
  // perform actions on the collection object
Into a regular script but it keeps saying const is availible in es6????

1 Like

Hi @Axulity_YT,

Check this topic on how to enable some es6 syntax in the editor, and get away with most of the warnings:

const is a keyword that is only available in JS ES6. ES6 is not yet fully compatible in browsers where WebGL can be ran without it being transpiled (converted) to ES5.

1 Like

Based on caniuse website, it is pretty safe to use const today, unless you care about outdated browsers (possibly third-world markets).

1 Like