Skip to main content

World markets dive as Trump sparks trade, North Korea worries

Global stocks sank Wednesday after US President Donald Trump said he was not satisfied with talks that are aimed at averting a trade war with China. Equities were also dented by poor eurozone economic data, and as Trump cast doubt on a planned summit with North Korean leader Kim Jong Un. “Trump (is) continuing to drive uncertainty over global trade,” said analyst Joshua Mahony at trading firm IG. “European markets are following their Asian counterparts lower, as a pessimistic tone from Trump is compounded by downbeat economic data,” he added. Markets had surged Monday after US Treasury Secretary Steven Mnuchin and Chinese Vice Premier Liu He said they had agreed to pull back from imposing threatened tariffs on billions of dollars of goods, and continue talks on a variety of trade issues. However, Trump has declared that he was “not satisfied” with the status of the talks, fuelling worries that the world’s top two economies could still slug out an economically pain...

How to Get Started with Microsoft Language 'TypeScript' .........

 Microsoft introduced TypeScript, a typed superset for JavaScript that compiles into plain JavaScript. TypeScript focuses on providing useful tools for large scale applications by implementing features, such as classes, type annotations, inheritance, modules and much more! In this tutorial, we will get started with TypeScript, using simple bite-sized code examples, compiling them into JavaScript, and viewing the instant results in a browser.
TypeScript features are enforced only at compile-time.
You'll set up your machine according to your specific platform and needs. Windows and Visual Studio users can simply download the Visual Studio Plugin. If you're on Windows and don't have Visual Studio, give Visual Studio Express for Web a try. The TypeScript experience in Visual Studio is currently superior to other code editors.
If you're on a different platform (or don't want to use Visual Studio), all you need is a text editor, a browser, and the TypeScript npm package to use TypeScript. Follow these installation instructions:
  1. Install Node Package Manager (npm)
  2. Install the TypeScript npm package globally in the command line:
  3. Any modern browserChrome is used for this tutorial
  4. Any text editor: Sublime Text is used for this tutorial
  5. Syntax highlighting plugin for text editors
That's it; we are ready to make a simple "Hello World" application in TypeScript!
TypeScript is a superset of Ecmascript 5 (ES5) and incorporates features proposed for ES6. Because of this, any JavaScript program is already a TypeScript program. The TypeScript compiler performs local file transformations on TypeScript programs. Hence, the final JavaScript output closely matches the TypeScript input.
First, we will create a basic index.html file and reference an external script file:
This is a simple "Hello World" application; so, let's create a file named hello.ts. The *.ts extension designates a TypeScript file. Add the following code to hello.ts:
Next, open the command line interface, navigate to the folder containing hello.ts, and execute the TypeScript compiler with the following command:
The tsc command is the TypeScript compiler, and it immediately generates a new file called hello.js. Our TypeScript application does not use any TypeScript-specific syntax, so we see the same exact JavaScript code in hello.js that we wrote in hello.ts.
Great! Now we can explore TypeScript's features and see how it can help us maintain and author large scale JavaScript applications.
Type annotations are an optional feature, which allows us to check and express our intent in the programs we write. Let's create a simple area() function in a new TypeScript file, called type.ts
Next, change the script source in index.html to type.js and run the TypeScript compiler with tsc type.ts. Refresh the page in the browser, and you should see the following:
As shown in the previous code, the type annotations are expressed as part of the function parameters; they indicate what types of values you can pass to the function. For example, the shape parameter is designated as a string value, and width and height are numeric values.
Type annotations, and other TypeScript features, are enforced only at compile-time. If you pass any other types of values to these parameters, the compiler will give you a compile-time error. This behavior is extremely helpful while building large-scale applications. For example, let's purposely pass a string value for the width parameter:
We know this results in an undesirable outcome, and compiling the file alerts us to the problem with the following error:
Notice that despite this error, the compiler generated the type.js file. The error doesn't stop the TypeScript compiler from generating the corresponding JavaScript, but the compiler does warn us of potential issues. We intend width to be a number; passing anything else results in undesired behavior in our code. Other type annotations include bool or even any.
Let's expand our example to include an interface that further describes a shape as an object with an optional color property. Create a new file called interface.ts, and modify the script source in index.htmlto include interface.js. Type the following code into interface.ts:
Interfaces are names given to object types. Not only can we declare an interface, but we can also use it as a type annotation.
Compiling interface.js results in no errors. To evoke an error, let's append another line of code to interface.js with a shape that has no name property and view the result in the console of the browser. Append this line to interface.js:
Now, compile the code with tsc interface.js. You'll receive an error, but don't worry about that right now. Refresh your browser and look at the console. You'll see something similar to the following screenshot:
Now let's look at the error. It is:
We see this error because the object passed to area() does not conform to the Shape interface; it needs a name property in order to do so.
Understanding the scope of the this keyword is challenging, and TypeScript makes it a little easier by supporting arrow function expressions, a new feature being discussed for ECMAScript 6. Arrow functions preserve the value of this, making it much easier to write and use callback functions. Consider the following code:
The this.name on line seven will clearly be empty, as demonstrated in the browser console:

Comments

Popular posts from this blog

How to Migrate from Bootstrap Version 3 to Advance Bootstrap 4.

This article would illustrate and expatiate on how to  migrate from Bootstrap 3 to Bootstrap 4 ? You’re in luck; today we’ll walk through the changes and new features between versions. The changes you need to make are generally just class renames and some set-up. To save you a lot of time scouring the changelog, I have compiled a list of the things you need to know when migrating from Bootstrap 3 to Bootstrap 4. We will start by discussing the changes made in Bootstrap 4 framework and how it will affect your website performance. Then we will examine the new way of  installing bootstrap and how the grid measurement unit  has change and how  flexbox can help on responsive designs . We will also discuss changes to some of the components and take a look what happens to JavaScript on the new version. Finally, we’ll take a look at some of the new components including cards, tooltips and flexbox. If you are getting ready to migrate a site from the old Bootst...

World markets dive as Trump sparks trade, North Korea worries

Global stocks sank Wednesday after US President Donald Trump said he was not satisfied with talks that are aimed at averting a trade war with China. Equities were also dented by poor eurozone economic data, and as Trump cast doubt on a planned summit with North Korean leader Kim Jong Un. “Trump (is) continuing to drive uncertainty over global trade,” said analyst Joshua Mahony at trading firm IG. “European markets are following their Asian counterparts lower, as a pessimistic tone from Trump is compounded by downbeat economic data,” he added. Markets had surged Monday after US Treasury Secretary Steven Mnuchin and Chinese Vice Premier Liu He said they had agreed to pull back from imposing threatened tariffs on billions of dollars of goods, and continue talks on a variety of trade issues. However, Trump has declared that he was “not satisfied” with the status of the talks, fuelling worries that the world’s top two economies could still slug out an economically pain...

Saturated Fats vs. Unsaturated Fats.

Saturated Fats vs. Unsaturated Fats Diffen  ›  Food  ›  Diet & Nutrition The human body needs both  saturated fats  and  unsaturated fats  to remain healthy. Most dietary recommendations suggest that, of the daily intake of fat, a higher proportion should be from unsaturated fats, as they are thought to promote  good cholesterol  and help prevent cardiovascular disease, whereas an overabundance of saturated fats is thought to promote bad cholesterol. However,  a few studies  have found that little evidence for a strong link between the consumption of saturated fat and cardiovascular disease. Note: It is technically more accurate to call saturated and unsaturated fats types of  fatty acids , as it is specifically the  fatty acid  found in a fat that is either saturated or unsaturated. However, referring to fatty acids as fats is common. Comparison chart Saturated Fats versus Unsaturated F...