SIGN IN SIGN UP

Login to your account

Username or Email *
Password *
Remember Me
LWC Progress | ( Lessons)

Lesson: 03 | Operators


Ternary Operator:

import { LightningElement, track } from 'lwc';

export default class TernaryExample extends LightningElement {
    @track isLoggedIn = true;

    greetingMessage = this.isLoggedIn ? 'Welcome, User!' : 'Please log in to continue';

    handleClick() {
        this.isLoggedIn = !this.isLoggedIn;
        this.greetingMessage = this.isLoggedIn ? 'Welcome, User!' : 'Please log in to continue';
    }
}

Prev You need to login to have access to the quizzes. Next

Mastered by 12 users.

Lightning Web Components

A. Component Reference (27 lessons)
B. Lightning Web Components | Utilities (11 lessons)
C. Lightning Web Component Guide (41 lessons)
D. Java Script Methods for LWC (23 lessons)
E. HTML (18 lessons)
Go to top