Skip to content

Issue in comparing number like 121 >= 50 , expected result true but getting false #40080

Closed
@mupadhyaya

Description

@mupadhyaya

Hi there,

I found the problem while working on testing >= comparison operator. In while comparing 121 >= 50 it always return false and we can see it should be true.

Is there anything I am missing? I am using Angular 9 and I believe it is the issue related with typescript. If anywhere I am incorrect please advise me for the correction.

`import { Component, TrackByFunction } from '@angular/core';

@component({
selector: 'my-app',
templateUrl: './app.component.html',
})
export class AppComponent {

constructor(

) {}

ngOnInit() {
let value1 = "121";
let value2 = "50";
let flag = value1 >= value2; // 121 >= 50 => true
console.log(${value1} >= ${value2} expected: true, output:, flag);
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions