Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

let in TypeScript

TypeScript (and ES6) introduces the let keyword to allow you to define variables with true block scope. That is if you use let instead of var you get a true unique element disconnected from what you might have defined outside the scope.

Following example code example demonstrates use of “let” which is truly block scoped.

Function getUserNameWithLet() returns username "nmk" which is block scoped.

Typescript Code:

function getUserNameWithVar()
    var userName = "ken";
    if (true) {
       var userName = "kendre";
    return userName;
function getUserNameWithLet() {
    let userName = "nmk";
    if (true) {
        let userName = "kendre";
    return userName;
window.onload = () => {
    var elNameWithVar = document.getElementById('lblFirstNameWithVar');
    var elNameWithLet = document.getElementById('lblFirstNameWithVar');
    elNameWithVar.innerHTML =getUserNameWithVar();
     elNameWithLet.innerHTML =getUserNameWithLet();

HTML code:

<html lang="en">
    <meta charset="utf-8" />
    <title>TypeScript HTML App</title>
    <link rel="stylesheet" href="app.css" type="text/css" />
    <script src="LetExample.js"></script>
    <h1>TypeScript HTML App</h1>
<label id="lblFirstNameWithVar"></label>
<label id="lblFirstNameWithLet"></label>

html input “file” type takes two tabs in IE and edge

html input “file” type takes two tabs and shift tab behavior is not perfect with IE and edge browser.

Try following simple html:

<input id="txtTest" type=text />
<input id="txtFile" type=file />
<input id="txtTest1" type=text />
<button type="button" id="testButton">test click</button>

Issue is  type=file takes 2 tabs think it should consider only one tab and shift tab behaviour is not perfect try with edge.

IE 11 and edge fails to display latest updated images

Issue/bug title: IE 11 and edge fails to display latest updated images (it displays image from cache in case of same image name) but chrome perfectly display updated image.

In detail:

Hi team I found browser specific issue with image cache and image rendering with IE 11 and edge (not able to refresh updated image) but it works perfectly with chrome browser.

Technical problem (We tried with web form and MVC projects)

Sharing Web from sample code:

With web form page we are updating image URL dynamically, the following code return updated image for specific user (same name for image url) and assign image URL dynamically.

   protected void Page_Load(object sender, EventArgs e)
          var imageDynamicUrl = ImageBuilder.GetProfileIamgeByUserName
         //updating image url dynamically
          imgProfile.ImageUrl = imageDynamicUrl;


Browser URL for html image tag:

1. Old image url(for user abc) /200wide/uaserProfile9.JPG (50kb)

2. Latest replaced image url (for user abc) /200wide/uaserProfile9.JPG(78kb)

Chrome browser showing updated image “uaserProfile9.JPG(78kb)” , with same code bit IE 11 and edge browser showing old image (from cache).

IE and edge showing latest image only when we refresh page or delete history (cache) and refresh page.