While working on a tutorial from Udemy, I encountered some unexpected errors:
Unexpected keyword or identifier.
, Member 'console' implicitly has an 'any' type.
, Unexpected token. A constructor, method, accessor, or property was expected.
, 'log', which lacks return-type annotation, implicitly has an 'any' return type.
, Identifier expected.
. On line 10 of my code is this snippet: console.log('example');
Could someone provide insight into what might have gone wrong here?
Edit: Below is the code snippet in question:
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class HardcodedAuthenticationService {
constructor() { }
console.log('example');
authenticate(username: any, password: any) {
if (username !== '' && password !== '') {
sessionStorage.setItem('authenticatedUser', username)
return true;
}
return false;
}
isUserLoggedIn() {
let user = sessionStorage.getItem('authenticatedUser');
return !(user === null)
};
}