Big Data Addition

Source: Internet
Author: User

Page:

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Big Data Addition</title></Head><Body><H3style= "margin-left:800px;margin-top:200px;">I'm the big Data add</H3></Body></HTML>

Js:

' Use strict '; import Base from'./base.js ';varFS = require (' FS '); Exportdefaultclass extends Base {/** * Index action * @return {Promise} []*/Async indexaction () {//Let RootPath = think. Root_path + "\\www\\"; Let Num1= await Fs.readfilesync (rootpath + "3.txt");//synchronized version of Fs.readfile () fs.readfilesync (filename, [encoding]) filename--> file pathLet num2 = await Fs.readfilesync (rootpath + "4.txt"); Let Sum=MySum (NUM1, num2); //Write FileFs.writefile (RootPath + "Sum.txt", Sum, ' UTF8 ', (err) = = {            if(ERR)Throwerr; Console.log (' The calculation results are saved successfully! ‘);        }); return  This. display (); }}/** * Sum method * @param num1 * @param num2 * @returns {string}*/functionMySum (NUM1, num2) {Let sum= ' '; Let Jin= 0;  for(Let i = num1.length-1; I >= 0; i--) {Let stmp= (Num1[i] + num2[i]-96); if(i==0) {sum= (Stmp + Jin) +sum; }  Else{sum= ((Stmp + Jin)% 10) +sum; } Jin= parseint (STMP/10); }    returnsum;}

Big Data Addition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.