SCC212 Javascript

Task 1: Frequency Counts
You've been asked to produce the counts of particular sequences handed to you from a test framework. The framework itself has a function for you to call with the results.
In essence, if you have been given the following sequence of nucleotide letters:
CCAAATT
We should be able to generate the following counts of each pattern in the following structure:
{ AA: 2, AT: 1, CC: 1, CA: 1, TT: 1 }
Note that 'AA' is detected as two patterns, as the first pair of 'A's then a second pair of overlapping 'A's:
CC AA ATT and CCA AA TT
Your code will be handed the input character-by-character, so it will be up to you how you decide to buffer and detect these sequences.
In the supplied .zip file, you should have 6 data files (in pairs, for each task), and two JavaScript files. One is the library you are to use (testlib.js) and the other is a template to base your implementation on (minimal_demo.js). You should not modify testlib.js . All need to be in the same folder to operate correctly.
To run the demo file, execute 'node minimal_demo.js' from the command line or terminal in the program's folder.

The minimal_demo includes how to connect to the testlib library, along with how to start the test. The source code of the library is documented on the functions available for your use.
For this particular task, you are required to use the testlib.frequencyTable() function to report your frequency counts. This function expects that you supply it with an object containing keys as specified by the patterns array in the 'ready' handler, each with a count of the number of times the program has seen that pattern.
Remember that you can access JavaScript object and array keys by square brackets.
An (extremely simple) example of how to do this might be:

Note: To know when one sequence stops and another begins, use the 'reset' hook via the testlib.on() function

相关推荐
牛奶5 分钟前
网关是怎么当"门卫"的?
前端·后端·负载均衡
天一生水water6 分钟前
VUE3入门
javascript
上海合宙LuatOS9 分钟前
合宙TCP/UDP web测试工具简介
前端·物联网·tcp/ip·udp·luatos
Komore31515 分钟前
java 泛型
java·开发语言·泛型
Hemy0815 分钟前
tauri + rust 创建初始项目
开发语言·后端·rust
yqcoder30 分钟前
JavaScript 浅拷贝:只复制“第一层”的艺术
开发语言·javascript·ecmascript
逻辑驱动的ken32 分钟前
Java高频面试考点场景题26
java·开发语言·面试·职场和发展·求职招聘
yqcoder34 分钟前
JavaScript 闭包:函数背后的“背包”
开发语言·javascript·ecmascript
Apifox.34 分钟前
Apifox 近期更新|AI Agent Debugger、A2A Debugger、Postman API 导入、Ask AI 侧边栏对话
前端·人工智能·后端·测试工具·测试用例·postman
阿里嘎多学长36 分钟前
2026-05-08 GitHub 热点项目精选
开发语言·程序员·github·代码托管