Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donuts238486y@beegC0de then how to declare a class with static fields, methods? That can be referenced from other files?
-
inaba46256y@billgates https://jsfiddle.net/x3anqscr/
And the best part is you can use them as you would properties in C# -
donuts238486y@inaba what about setters? That get keyword seems like a new JS thing....
Seems like I need to relearn JS from the start... Again.... -
donuts238486y@beegC0de The JS keywords I know are
var, function and maybe require and import, I think those are node's. -
donuts238486y@jschmold thanks. what's the myFunc = () => {}
Is the () just shorthand for function()
I never understood... why not just declare then the old way. function doStuff(...) {}
Actually the biggest thing I hate about JS and lambdas is when ppl nest a whole bunch of them and then the inner ones use variables from the outer ones...
I believe it used to be called callback hell... -
donuts238486y@jschmold async, await.... Looks like have to relearn the whole async thing too. I use it in C# to prevent GUI lockups with multithreading/background tasks but I remember for JS the reason is different, Node can only use a single thread?
-
Just a friendly comment: if you don’t use Babel transform (rarely needed in node.js) try avoid es6 syntax.
I want to create a static JS class/file to hold shared functions but I can't seem to make it usable in other JS files.
import DbCommons from './commons' //Same folder
getCategories() {
return this.db.transaction((tx) => {
tx.executeSql('SELECT * FROM ' + DbCommons.CategoryTable, []) //Says not found
I forget how do I make things visible outisde of the actualy JS file
rant