I want to use inheritance between classes that are in separate .js (but same folder), but i have this errors
Uncaught SyntaxError: Unexpected identifier
Uncaught ReferenceError: TableWithFunction is not defined
Here goes my code:
// Table.js
export default class Table {
constructor(name, h_cols) {
table_id = name + 'table';
hidden_cols = h_cols;
table = setTable();
}
setTable() {...};
setColumnDefs() {...};
{
// TableWithFunction.js
import Table from 'Table';
class TableWithFunction extends Table {
constructor (name, h_cols) {
super(name, h_cols);
selected_id = name + 'Selected';
}
//More methods ..
}
//test.blade.php (im using laravel framework)
<script src="{{ url('js/TableWithFunction.js') }}" ></script>
<script>
roleTable = new TableWithFunction('role',[2, 4]);
userTable = new TableWithFunction('user',[3]);
</script>
I also tried to do import Table from 'Table.js';
instead of import Table from 'Table';
And i tried changing Table.js using class Table { ... } export default Table
instead of export default class Table {...}
and it didn't fix it, of course.