function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sachin Bhalerao 17Sachin Bhalerao 17 

Unable to unserstand Lightning Web Component Code?

Dear Team ,

Greetings !!!

Through Trailhead i picked one example of Hello World in Lightning Web Component . This code is running and component is also created in App Builder but i am unable to unserstand the code . Would you plz let me understand how it works and what is the functionality of 

   @track greeting = 'World';
    changeHandler(event) {
        this.greeting = event.target.value;


HTML Code:

<template>
    <lightning-card title="HelloWorld" icon-name="custom:custom14">
        <div class="slds-m-around_medium">
            <p>Hello, {greeting}!</p>
            <lightning-input label="Name" value={greeting} onchange={changeHandler}></lightning-input>
        </div>
    </lightning-card>
</template>


Javascript:

import { LightningElement, track } from 'lwc';
export default class HelloWorld extends LightningElement {
    @track greeting = 'World';
    changeHandler(event) {
        this.greeting = event.target.value;
    }
}

meta.XML

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">
  <apiVersion>45.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>

Thanks & Regards
Sachin Bhalerao
Nisar AhmadNisar Ahmad
@Sachin,

You can try below link I hope it is helpful for you:

https://lwc.dev/guide/introduction
 
I hope you find the above solution helpful. 

Thanks